From patchwork Thu Mar 26 21:09:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62611 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZlo-00Bcrj-4z; Thu, 26 Mar 2020 21:10:32 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727846AbgCZVMp (ORCPT + 1 other); Thu, 26 Mar 2020 17:12:45 -0400 Received: from sauhun.de ([88.99.104.3]:54276 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbgCZVJv (ORCPT ); Thu, 26 Mar 2020 17:09:51 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id E43FD2C1F87; Thu, 26 Mar 2020 22:09:48 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] media: pci: cx88: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:41 +0100 Message-Id: <20200326210947.12747-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API and make use of the fact that unregistering devices is NULL- and ERR_PTR-safe. Signed-off-by: Wolfram Sang --- drivers/media/pci/cx88/cx88-core.c | 3 +-- drivers/media/pci/cx88/cx88-input.c | 2 +- drivers/media/pci/cx88/cx88-video.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-core.c b/drivers/media/pci/cx88/cx88-core.c index dcadf78657d6..48c8a3429542 100644 --- a/drivers/media/pci/cx88/cx88-core.c +++ b/drivers/media/pci/cx88/cx88-core.c @@ -1070,8 +1070,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) mutex_lock(&devlist); cx88_ir_fini(core); if (core->i2c_rc == 0) { - if (core->i2c_rtc) - i2c_unregister_device(core->i2c_rtc); + i2c_unregister_device(core->i2c_rtc); i2c_del_adapter(&core->i2c_adap); } list_del(&core->devlist); diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index c7c2acd55266..7e0fed9cd200 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -638,7 +638,7 @@ void cx88_i2c_init_ir(struct cx88_core *core) I2C_SMBUS_READ, 0, I2C_SMBUS_QUICK, NULL) >= 0) { info.addr = *addrp; - i2c_new_device(&core->i2c_adap, &info); + i2c_new_client_device(&core->i2c_adap, &info); break; } } diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 6aabc45aa93c..ba0e9660a047 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -1385,7 +1385,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, }; request_module("rtc-isl1208"); - core->i2c_rtc = i2c_new_device(&core->i2c_adap, &rtc_info); + core->i2c_rtc = i2c_new_client_device(&core->i2c_adap, &rtc_info); } /* fall-through */ case CX88_BOARD_DVICO_FUSIONHDTV_5_PCI_NANO: From patchwork Thu Mar 26 21:09:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62609 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZla-00Bcqs-9p; Thu, 26 Mar 2020 21:10:18 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727708AbgCZVJw (ORCPT + 1 other); Thu, 26 Mar 2020 17:09:52 -0400 Received: from sauhun.de ([88.99.104.3]:54286 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgCZVJv (ORCPT ); Thu, 26 Mar 2020 17:09:51 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id 7694F2C1F88; Thu, 26 Mar 2020 22:09:49 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] media: pci: saa7134: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:42 +0100 Message-Id: <20200326210947.12747-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API. Signed-off-by: Wolfram Sang --- drivers/media/pci/saa7134/saa7134-input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index 9aea7c30380b..8610eb473b39 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -982,7 +982,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) if (dev->init_data.name) info.platform_data = &dev->init_data; - i2c_new_device(&dev->i2c_adap, &info); + i2c_new_client_device(&dev->i2c_adap, &info); } static int saa7134_raw_decode_irq(struct saa7134_dev *dev) From patchwork Thu Mar 26 21:09:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62610 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZlg-00BcrR-C3; Thu, 26 Mar 2020 21:10:24 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728237AbgCZVMj (ORCPT + 1 other); Thu, 26 Mar 2020 17:12:39 -0400 Received: from sauhun.de ([88.99.104.3]:54296 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726954AbgCZVJv (ORCPT ); Thu, 26 Mar 2020 17:09:51 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id 04E232C1F89; Thu, 26 Mar 2020 22:09:49 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Jonathan Corbet , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] media: marvell-ccic: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:43 +0100 Message-Id: <20200326210947.12747-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang --- drivers/media/platform/marvell-ccic/cafe-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c b/drivers/media/platform/marvell-ccic/cafe-driver.c index 37fdcc53a1c4..9a09a10a3631 100644 --- a/drivers/media/platform/marvell-ccic/cafe-driver.c +++ b/drivers/media/platform/marvell-ccic/cafe-driver.c @@ -556,7 +556,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, clkdev_create(mcam->mclk, "xclk", "%d-%04x", i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr); - if (i2c_new_device(cam->i2c_adapter, &ov7670_info)) { + if (!IS_ERR(i2c_new_client_device(cam->i2c_adapter, &ov7670_info))) { cam->registered = 1; return 0; } From patchwork Thu Mar 26 21:09:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62606 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZiy-00BcmM-0W; Thu, 26 Mar 2020 21:07:36 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727740AbgCZVJy (ORCPT + 1 other); Thu, 26 Mar 2020 17:09:54 -0400 Received: from sauhun.de ([88.99.104.3]:54328 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727473AbgCZVJw (ORCPT ); Thu, 26 Mar 2020 17:09:52 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id 87EE82C1F8A; Thu, 26 Mar 2020 22:09:50 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] media: usb: cx231xx: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:44 +0100 Message-Id: <20200326210947.12747-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API and make use of the fact that unregistering devices is NULL- and ERR_PTR-safe. Signed-off-by: Wolfram Sang --- drivers/media/usb/cx231xx/cx231xx-input.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c index 9f88c640ec2b..8149702bcf89 100644 --- a/drivers/media/usb/cx231xx/cx231xx-input.c +++ b/drivers/media/usb/cx231xx/cx231xx-input.c @@ -88,7 +88,7 @@ int cx231xx_ir_init(struct cx231xx *dev) ir_i2c_bus = cx231xx_boards[dev->model].ir_i2c_master; dev_dbg(dev->dev, "Trying to bind ir at bus %d, addr 0x%02x\n", ir_i2c_bus, info.addr); - dev->ir_i2c_client = i2c_new_device( + dev->ir_i2c_client = i2c_new_client_device( cx231xx_get_i2c_adap(dev, ir_i2c_bus), &info); return 0; @@ -96,7 +96,6 @@ int cx231xx_ir_init(struct cx231xx *dev) void cx231xx_ir_exit(struct cx231xx *dev) { - if (dev->ir_i2c_client) - i2c_unregister_device(dev->ir_i2c_client); + i2c_unregister_device(dev->ir_i2c_client); dev->ir_i2c_client = NULL; } From patchwork Thu Mar 26 21:09:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62607 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZlO-00BcqX-V5; Thu, 26 Mar 2020 21:10:07 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727766AbgCZVJy (ORCPT + 1 other); Thu, 26 Mar 2020 17:09:54 -0400 Received: from sauhun.de ([88.99.104.3]:54332 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbgCZVJx (ORCPT ); Thu, 26 Mar 2020 17:09:53 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id 234122C1F8B; Thu, 26 Mar 2020 22:09:51 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Hans Verkuil , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] media: usb: hdpvr: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:45 +0100 Message-Id: <20200326210947.12747-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang --- drivers/media/usb/hdpvr/hdpvr-core.c | 4 ++-- drivers/media/usb/hdpvr/hdpvr-i2c.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index b75c18a012a7..52e05a69c46e 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -363,9 +363,9 @@ static int hdpvr_probe(struct usb_interface *interface, } client = hdpvr_register_ir_i2c(dev); - if (!client) { + if (IS_ERR(client)) { v4l2_err(&dev->v4l2_dev, "i2c IR device register failed\n"); - retval = -ENODEV; + retval = PTR_ERR(client); goto reg_fail; } #endif diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c index 785c8508a46e..070559b01b01 100644 --- a/drivers/media/usb/hdpvr/hdpvr-i2c.c +++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c @@ -44,7 +44,7 @@ struct i2c_client *hdpvr_register_ir_i2c(struct hdpvr_device *dev) init_data->polling_interval = 405; /* ms, duplicated from Windows */ info.platform_data = init_data; - return i2c_new_device(&dev->i2c_adapter, &info); + return i2c_new_client_device(&dev->i2c_adapter, &info); } static int hdpvr_i2c_read(struct hdpvr_device *dev, int bus, From patchwork Thu Mar 26 21:09:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 62608 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from ) id 1jHZlY-00Bcqs-Sv; Thu, 26 Mar 2020 21:10:17 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728055AbgCZVMb (ORCPT + 1 other); Thu, 26 Mar 2020 17:12:31 -0400 Received: from sauhun.de ([88.99.104.3]:54342 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgCZVJx (ORCPT ); Thu, 26 Mar 2020 17:09:53 -0400 Received: from localhost (p54B3331F.dip0.t-ipconnect.de [84.179.51.31]) by pokefinder.org (Postfix) with ESMTPSA id B20A02C1F84; Thu, 26 Mar 2020 22:09:51 +0100 (CET) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Wolfram Sang , Mike Isely , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] media: usb: pvrusb2: convert to use i2c_new_client_device() Date: Thu, 26 Mar 2020 22:09:46 +0100 Message-Id: <20200326210947.12747-7-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> References: <20200326210947.12747-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Move away from the deprecated API. Signed-off-by: Wolfram Sang Acked-by: Mike Isely --- drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c index 275394bafe7d..63db04fe12d3 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c @@ -564,7 +564,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) strscpy(info.type, "ir_video", I2C_NAME_SIZE); pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", info.type, info.addr); - i2c_new_device(&hdw->i2c_adap, &info); + i2c_new_client_device(&hdw->i2c_adap, &info); break; case PVR2_IR_SCHEME_ZILOG: /* HVR-1950 style */ case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ @@ -579,7 +579,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw) strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); pvr2_trace(PVR2_TRACE_INFO, "Binding %s to i2c address 0x%02x.", info.type, info.addr); - i2c_new_device(&hdw->i2c_adap, &info); + i2c_new_client_device(&hdw->i2c_adap, &info); break; default: /* The device either doesn't support I2C-based IR or we