Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3900620rwi; Wed, 12 Oct 2022 08:08:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tDSD0+K7vnuDn+xt9lTqru/MbxvrRcad3LM1awtU75Asvcs8HvjgQJCtUcdj7c+UFDZ8Q X-Received: by 2002:a17:90a:d48b:b0:20a:97fb:3eb with SMTP id s11-20020a17090ad48b00b0020a97fb03ebmr5540648pju.189.1665587310779; Wed, 12 Oct 2022 08:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665587310; cv=none; d=google.com; s=arc-20160816; b=eWMVYmaFbBqKqCr2hw1CKJRVPUJnYzbnHkUP4rRKnJOL6KZKBH7esPu1fxL6Jkq0gb KaxOIZedZvZnRVSQ5rMdd1vLIvsD3EpcdOofoqPktxedD/3P1rHQ7/XdR5XqAxPvUcDM M2M4bKZQ3SJjpkXrMOSLjs5p7nYbaus0stgBLq8mEWvsH4LBXSIhSlTydZcul6HhQhm0 sDhz8qCEJTITReFirqQft9tZ+ySElZ7lstX7x5xw+lxqLjQTQPVQgd4QtKOy2N4b3eC0 zGa7PdVConw/jubnkB7OgdRZ8w38BfvENtb60EO+7F1pRgDJR8HdLBVxJ8JatCO0SXKg 7BwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=mUDZjcw1UbrhdFKEbYR1do25LCGaSfRl2u0rPCn2ZdM=; b=WMKROBesbWuqesrKjN8hZ6esIwj378Pn9KnaXCBM3eoo1ro9jEM5crCTek1Ek1jE07 FkJ6UrIJVqvPF1b0vsuUsXB6MqO2tiGDy2VXOsUREW/71RvZ3fjTFQZ0ogJO1Zw4qxi3 ARgj687QMuH4kEeuuY+9PxfMdJ4yIidWVd6iB5eoWoe3s+4DgkRU14tWUqnDY0pdcgpB uDoNK0XAzz/9WFcYcd64uzdiP0DPFoifTlOd8c5YrJYQz8Lg9FeQzcWM3WPvTzUXwRaZ +hGIhD4w+ceZiG78M1o+NYjte3lYOfkCnW2nqTBcuPPvapoaUhUyXyb8hEf9a570aR4G wAcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm9-20020a17090b3ec900b001faf9ba369fsi2688045pjb.164.2022.10.12.08.08.18; Wed, 12 Oct 2022 08:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229612AbiJLOhW (ORCPT + 99 others); Wed, 12 Oct 2022 10:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbiJLOhU (ORCPT ); Wed, 12 Oct 2022 10:37:20 -0400 X-Greylist: delayed 601 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 12 Oct 2022 07:37:18 PDT Received: from 4.mo575.mail-out.ovh.net (4.mo575.mail-out.ovh.net [46.105.59.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0B16402D7 for ; Wed, 12 Oct 2022 07:37:18 -0700 (PDT) Received: from player746.ha.ovh.net (unknown [10.110.208.22]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 87AE724FA6 for ; Wed, 12 Oct 2022 14:18:54 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player746.ha.ovh.net (Postfix) with ESMTPSA id 098612240642C; Wed, 12 Oct 2022 14:18:50 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-95G001fb4e0ef8-106b-41a5-ada3-e1102ea64411, 75377E6B882747309559AE06BD3DFEEF97A89409) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: MyungJoo Ham , Chanwoo Choi Cc: Stephen Kitt , linux-kernel@vger.kernel.org Subject: [PATCH] drivers/extcon: use simple i2c probe Date: Wed, 12 Oct 2022 16:18:46 +0200 Message-Id: <20221012141846.3916480-1-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 14757733032743241435 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedrfeejkedgjeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkofgggfestdekredtredttdenucfhrhhomhepufhtvghphhgvnhcumfhithhtuceoshhtvghvvgesshhkvddrohhrgheqnecuggftrfgrthhtvghrnhepleegteeujeffjeefjeevhfdtudefjefgteelgedtudekleeiledvvdetudevjedtnecukfhppeduvdejrddtrddtrddupdekvddrieehrddvhedrvddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheejhedpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All these drivers have an i2c probe function which doesn't use the "struct i2c_device_id *id" parameter, so they can trivially be converted to the "probe_new" style of probe with a single argument. This is part of an ongoing transition to single-argument i2c probe functions. Old-style probe functions involve a call to i2c_match_id: in drivers/i2c/i2c-core-base.c, /* * When there are no more users of probe(), * rename probe_new to probe. */ if (driver->probe_new) status = driver->probe_new(client); else if (driver->probe) status = driver->probe(client, i2c_match_id(driver->id_table, client)); else status = -EINVAL; Drivers which don't need the second parameter can be declared using probe_new instead, avoiding the call to i2c_match_id. Drivers which do can still be converted to probe_new-style, calling i2c_match_id themselves (as is done currently for of_match_id). This change was done using the following Coccinelle script, and fixed up for whitespace changes: @ rule1 @ identifier fn; identifier client, id; @@ - static int fn(struct i2c_client *client, const struct i2c_device_id *id) + static int fn(struct i2c_client *client) { ...when != id } @ rule2 depends on rule1 @ identifier rule1.fn; identifier driver; @@ struct i2c_driver driver = { - .probe + .probe_new = ( fn | - &fn + fn ) , }; Signed-off-by: Stephen Kitt --- drivers/extcon/extcon-fsa9480.c | 5 ++--- drivers/extcon/extcon-rt8973a.c | 5 ++--- drivers/extcon/extcon-usbc-tusb320.c | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/extcon/extcon-fsa9480.c b/drivers/extcon/extcon-fsa9480.c index 7cff66c29907..e8b2671eb29b 100644 --- a/drivers/extcon/extcon-fsa9480.c +++ b/drivers/extcon/extcon-fsa9480.c @@ -257,8 +257,7 @@ static irqreturn_t fsa9480_irq_handler(int irq, void *data) return IRQ_HANDLED; } -static int fsa9480_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int fsa9480_probe(struct i2c_client *client) { struct fsa9480_usbsw *info; int ret; @@ -370,7 +369,7 @@ static struct i2c_driver fsa9480_i2c_driver = { .pm = &fsa9480_pm_ops, .of_match_table = fsa9480_of_match, }, - .probe = fsa9480_probe, + .probe_new = fsa9480_probe, .id_table = fsa9480_id, }; diff --git a/drivers/extcon/extcon-rt8973a.c b/drivers/extcon/extcon-rt8973a.c index e6e448f6ea2f..afc9b405d103 100644 --- a/drivers/extcon/extcon-rt8973a.c +++ b/drivers/extcon/extcon-rt8973a.c @@ -548,8 +548,7 @@ static void rt8973a_init_dev_type(struct rt8973a_muic_info *info) } } -static int rt8973a_muic_i2c_probe(struct i2c_client *i2c, - const struct i2c_device_id *id) +static int rt8973a_muic_i2c_probe(struct i2c_client *i2c) { struct device_node *np = i2c->dev.of_node; struct rt8973a_muic_info *info; @@ -696,7 +695,7 @@ static struct i2c_driver rt8973a_muic_i2c_driver = { .pm = &rt8973a_muic_pm_ops, .of_match_table = rt8973a_dt_match, }, - .probe = rt8973a_muic_i2c_probe, + .probe_new = rt8973a_muic_i2c_probe, .remove = rt8973a_muic_i2c_remove, .id_table = rt8973a_i2c_id, }; diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c index 6ba3d89b106d..ca752ddf7763 100644 --- a/drivers/extcon/extcon-usbc-tusb320.c +++ b/drivers/extcon/extcon-usbc-tusb320.c @@ -230,8 +230,7 @@ static const struct regmap_config tusb320_regmap_config = { .val_bits = 8, }; -static int tusb320_extcon_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int tusb320_extcon_probe(struct i2c_client *client) { struct tusb320_priv *priv; const void *match_data; @@ -313,7 +312,7 @@ static const struct of_device_id tusb320_extcon_dt_match[] = { MODULE_DEVICE_TABLE(of, tusb320_extcon_dt_match); static struct i2c_driver tusb320_extcon_driver = { - .probe = tusb320_extcon_probe, + .probe_new = tusb320_extcon_probe, .driver = { .name = "extcon-tusb320", .of_match_table = tusb320_extcon_dt_match, base-commit: 833477fce7a14d43ae4c07f8ddc32fa5119471a2 -- 2.30.2