From patchwork Tue Jul 30 17:55:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11066409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 74B111395 for ; Tue, 30 Jul 2019 17:56:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65738280B0 for ; Tue, 30 Jul 2019 17:56:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5454A284B9; Tue, 30 Jul 2019 17:56:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB408280B0 for ; Tue, 30 Jul 2019 17:56:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387522AbfG3R4N (ORCPT ); Tue, 30 Jul 2019 13:56:13 -0400 Received: from sauhun.de ([88.99.104.3]:55986 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbfG3R4L (ORCPT ); Tue, 30 Jul 2019 13:56:11 -0400 Received: from localhost (p54B33338.dip0.t-ipconnect.de [84.179.51.56]) by pokefinder.org (Postfix) with ESMTPSA id EC5422E408C; Tue, 30 Jul 2019 19:56:09 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Sean Young , linux-media@vger.kernel.org, Wolfram Sang , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] media: ir-kbd-i2c: convert to i2c_new_dummy_device() Date: Tue, 30 Jul 2019 19:55:54 +0200 Message-Id: <20190730175555.14098-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190730175555.14098-1-wsa+renesas@sang-engineering.com> References: <20190730175555.14098-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 X-Virus-Scanned: ClamAV using ClamSMTP Convert this driver to use the new i2c_new_dummy_device() call and bail out if the dummy device cannot be registered to make failure more visible to the user. Signed-off-by: Wolfram Sang --- Change since v1: * reworded commit message because there was no NULL ptr access drivers/media/i2c/ir-kbd-i2c.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index 876d7587a1da..f46717052efc 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -885,9 +885,12 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) INIT_DELAYED_WORK(&ir->work, ir_work); if (probe_tx) { - ir->tx_c = i2c_new_dummy(client->adapter, 0x70); - if (!ir->tx_c) { + ir->tx_c = devm_i2c_new_dummy_device(&client->dev, + client->adapter, 0x70); + if (IS_ERR(ir->tx_c)) { dev_err(&client->dev, "failed to setup tx i2c address"); + err = PTR_ERR(ir->tx_c); + goto err_out_free; } else if (!zilog_init(ir)) { ir->carrier = 38000; ir->duty_cycle = 40; @@ -904,9 +907,6 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) return 0; err_out_free: - if (ir->tx_c) - i2c_unregister_device(ir->tx_c); - /* Only frees rc if it were allocated internally */ rc_free_device(rc); return err; @@ -919,9 +919,6 @@ static int ir_remove(struct i2c_client *client) /* kill outstanding polls */ cancel_delayed_work_sync(&ir->work); - if (ir->tx_c) - i2c_unregister_device(ir->tx_c); - /* unregister device */ rc_unregister_device(ir->rc); From patchwork Tue Jul 30 17:55:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 11066411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A10B913A0 for ; Tue, 30 Jul 2019 17:56:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 949A5280B0 for ; Tue, 30 Jul 2019 17:56:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 882E5284B9; Tue, 30 Jul 2019 17:56:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F856280B0 for ; Tue, 30 Jul 2019 17:56:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387512AbfG3R4M (ORCPT ); Tue, 30 Jul 2019 13:56:12 -0400 Received: from sauhun.de ([88.99.104.3]:56000 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726964AbfG3R4M (ORCPT ); Tue, 30 Jul 2019 13:56:12 -0400 Received: from localhost (p54B33338.dip0.t-ipconnect.de [84.179.51.56]) by pokefinder.org (Postfix) with ESMTPSA id 80ED42E354A; Tue, 30 Jul 2019 19:56:10 +0200 (CEST) From: Wolfram Sang To: linux-i2c@vger.kernel.org Cc: Sean Young , linux-media@vger.kernel.org, Wolfram Sang , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] media: ir-kbd-i2c: remove outdated comments Date: Tue, 30 Jul 2019 19:55:55 +0200 Message-Id: <20190730175555.14098-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190730175555.14098-1-wsa+renesas@sang-engineering.com> References: <20190730175555.14098-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 X-Virus-Scanned: ClamAV using ClamSMTP The "free memory" comment is obsolete since 2013 and the other ones explain the obvious. Just remove the comments. Signed-off-by: Wolfram Sang --- Change since v1: * none drivers/media/i2c/ir-kbd-i2c.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c index f46717052efc..30fde0e025c9 100644 --- a/drivers/media/i2c/ir-kbd-i2c.c +++ b/drivers/media/i2c/ir-kbd-i2c.c @@ -916,13 +916,9 @@ static int ir_remove(struct i2c_client *client) { struct IR_i2c *ir = i2c_get_clientdata(client); - /* kill outstanding polls */ cancel_delayed_work_sync(&ir->work); - - /* unregister device */ rc_unregister_device(ir->rc); - /* free memory */ return 0; }