From patchwork Mon Jun 15 07:58:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11606653 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 56AC06A2 for ; Tue, 16 Jun 2020 07:09:25 +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 35DF02082F for ; Tue, 16 Jun 2020 07:09:25 +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="X/pORW/d" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35DF02082F 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 990D76E7E6; 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 B959189C51 for ; Mon, 15 Jun 2020 07:58:29 +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=I0WHFYAv4nxQs6 tkAm55ITf+hr7ghVSe5IeMsWR0Ebw=; b=X/pORW/dgUb3m2RPbwaCx5wMOMh+cF RkM8TtjpetEVkBK0GW6zrJzTuKlK0WNT+5bU6OaabLgGlj/N1412Hjzb5BKrl+Lo IKfFHN5BnqFiIFTqzBtflEBW9916RdijN4mBrii+MIAWWhXwd5dxvzBJpE9yTKlu kI2aiSI4JMGT4= Received: (qmail 989136 invoked from network); 15 Jun 2020 09:58:27 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Jun 2020 09:58:27 +0200 X-UD-Smtp-Session: l3s3148p1@p029yhqoCLYgAwDPXwRdAFnN6pRlEuNX From: Wolfram Sang To: linux-i2c@vger.kernel.org Subject: [PATCH 1/6] drm: encoder_slave: fix refcouting error for modules Date: Mon, 15 Jun 2020 09:58:10 +0200 Message-Id: <20200615075816.2848-2-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 , Dave Airlie Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" module_put() balances try_module_get(), not request_module(). Fix the error path to match that. Fixes: 2066facca4c7 ("drm/kms: slave encoder interface.") 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c index cf804389f5ec..d50a7884e69e 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/drm_encoder_slave.c @@ -84,7 +84,7 @@ int drm_i2c_encoder_init(struct drm_device *dev, err = encoder_drv->encoder_init(client, dev, encoder); if (err) - goto fail_unregister; + goto fail_module_put; if (info->platform_data) encoder->slave_funcs->set_config(&encoder->base, @@ -92,9 +92,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, return 0; +fail_module_put: + module_put(module); fail_unregister: i2c_unregister_device(client); - module_put(module); fail: return err; } 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); From patchwork Mon Jun 15 07:58:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11606649 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 E8B8990 for ; Tue, 16 Jun 2020 07:09:20 +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 C83D12082F for ; Tue, 16 Jun 2020 07:09:20 +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="ZJzgOZhC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C83D12082F 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 EF1CE6E184; Tue, 16 Jun 2020 07:09:12 +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 53B3889E06 for ; Mon, 15 Jun 2020 07:58:35 +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=zy9ju7B6YlDDHE ooLxFkrGU+ZF5mtEjzYhXAsCLKff0=; b=ZJzgOZhC1+clVG+dYzuwHLtkuNQiVP 8i/w8ENmpvV/PkIYUiMSd68dh45K9gwwZez+JRqlsGtwiuOBU5JQmHZ6QSeJyN5n voFrkUqBaQUygGoB3q3sAiJ4H98h2X9CmuN33PdjVxtzISc5SM4r00MoqHF1aF3M /HY0LWJP5rrHY= Received: (qmail 989253 invoked from network); 15 Jun 2020 09:58:29 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 15 Jun 2020 09:58:29 +0200 X-UD-Smtp-Session: l3s3148p1@FhXZyhqoDrYgAwDPXwRdAFnN6pRlEuNX From: Wolfram Sang To: linux-i2c@vger.kernel.org Subject: [PATCH 4/6] video: backlight: tosa_lcd: convert to use i2c_new_client_device() Date: Mon, 15 Jun 2020 09:58:13 +0200 Message-Id: <20200615075816.2848-5-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: Daniel Thompson , Bartlomiej Zolnierkiewicz , Jingoo Han , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Wolfram Sang , Lee Jones Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang Reviewed-by: Daniel Thompson Acked-by: Lee Jones --- I'd like to push it via I2C for 5.8-rc2. drivers/video/backlight/tosa_lcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index e8ab583e5098..113116d3585c 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c @@ -107,7 +107,7 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data) /* TG LCD GVSS */ tosa_tg_send(spi, TG_PINICTL, 0x0); - if (!data->i2c) { + if (IS_ERR_OR_NULL(data->i2c)) { /* * after the pannel is powered up the first time, * we can access the i2c bus so probe for the DAC @@ -119,7 +119,7 @@ static void tosa_lcd_tg_on(struct tosa_lcd_data *data) .addr = DAC_BASE, .platform_data = data->spi, }; - data->i2c = i2c_new_device(adap, &info); + data->i2c = i2c_new_client_device(adap, &info); } }