From patchwork Mon Jun 15 07:58:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11606657 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25B3C90 for ; Tue, 16 Jun 2020 07:09:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0532420DD4 for ; Tue, 16 Jun 2020 07:09:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="NWCRR5jF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0532420DD4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CF676E7E2; Tue, 16 Jun 2020 07:09:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by gabe.freedesktop.org (Postfix) with ESMTPS id 336BA89E06 for ; Mon, 15 Jun 2020 07:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=k1; bh=fF3lSMGhBbMaEw 4hJjPl3xbw8QAkMzTwyEaeb0Y2E18=; b=NWCRR5jFc5pHDpaf5EMWFAZjeY/Dpi UZe1XMHxf7OASSyG0rHjOPg+uOYoMByMCzbgucAutMXB4sld05x0Qz4EqkGZvjD3 R4jTWe0JRh2NnVWFSB65hwiESmkKRLPvrF/nsta3Knp6z9SesgtOetvuyM3uAuIp qo4UY+k9BXefA= Received: (qmail 989178 invoked from network); 15 Jun 2020 09:58:28 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Jun 2020 09:58:28 +0200 X-UD-Smtp-Session: l3s3148p1@X3PGyhqoCrYgAwDPXwRdAFnN6pRlEuNX From: Wolfram Sang To: linux-i2c@vger.kernel.org Subject: [PATCH 2/6] drm: encoder_slave: use new I2C API Date: Mon, 15 Jun 2020 09:58:11 +0200 Message-Id: <20200615075816.2848-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200615075816.2848-1-wsa+renesas@sang-engineering.com> References: <20200615075816.2848-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 16 Jun 2020 07:09:12 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Emil Velikov , linux-kernel@vger.kernel.org, Wolfram Sang , dri-devel@lists.freedesktop.org, Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" i2c_new_client() is deprecated, use the replacement i2c_new_client_device(). Also, we have a helper to check if a driver is bound. Use it to simplify the code. Note that this changes the errno for a failed device creation from ENOMEM to ENODEV. No callers currently interpret this errno, though, so we use this condensed error check. Signed-off-by: Wolfram Sang Reviewed-by: Emil Velikov --- I'd like to push it via I2C for 5.8-rc2. drivers/gpu/drm/drm_encoder_slave.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c index d50a7884e69e..e464429d32df 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/drm_encoder_slave.c @@ -61,13 +61,8 @@ int drm_i2c_encoder_init(struct drm_device *dev, request_module("%s%s", I2C_MODULE_PREFIX, info->type); - client = i2c_new_device(adap, info); - if (!client) { - err = -ENOMEM; - goto fail; - } - - if (!client->dev.driver) { + client = i2c_new_client_device(adap, info); + if (!i2c_client_has_driver(client)) { err = -ENODEV; goto fail_unregister; } @@ -96,7 +91,6 @@ int drm_i2c_encoder_init(struct drm_device *dev, module_put(module); fail_unregister: i2c_unregister_device(client); -fail: return err; } EXPORT_SYMBOL(drm_i2c_encoder_init);