Commit 3f4a3322 authored by Stephen Kitt's avatar Stephen Kitt Committed by Alexandre Belloni
Browse files

rtc: use simple i2c probe



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 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: default avatarStephen Kitt <steve@sk2.org>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20220610162346.4134094-1-steve@sk2.org
parent 33740c7f
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -817,8 +817,7 @@ static const struct regmap_config abb5zes3_rtc_regmap_config = {
	.val_bits = 8,
};

static int abb5zes3_probe(struct i2c_client *client,
			  const struct i2c_device_id *id)
static int abb5zes3_probe(struct i2c_client *client)
{
	struct abb5zes3_rtc_data *data = NULL;
	struct device *dev = &client->dev;
@@ -945,7 +944,7 @@ static struct i2c_driver abb5zes3_driver = {
		.pm = &abb5zes3_rtc_pm_ops,
		.of_match_table = of_match_ptr(abb5zes3_dt_match),
	},
	.probe	  = abb5zes3_probe,
	.probe_new = abb5zes3_probe,
	.id_table = abb5zes3_id,
};
module_i2c_driver(abb5zes3_driver);
+2 −3
Original line number Diff line number Diff line
@@ -495,8 +495,7 @@ static void abeoz9_hwmon_register(struct device *dev,

#endif

static int abeoz9_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
static int abeoz9_probe(struct i2c_client *client)
{
	struct abeoz9_rtc_data *data = NULL;
	struct device *dev = &client->dev;
@@ -580,7 +579,7 @@ static struct i2c_driver abeoz9_driver = {
		.name = "rtc-ab-eoz9",
		.of_match_table = of_match_ptr(abeoz9_dt_match),
	},
	.probe	  = abeoz9_probe,
	.probe_new = abeoz9_probe,
	.id_table = abeoz9_id,
};

+2 −3
Original line number Diff line number Diff line
@@ -249,8 +249,7 @@ static void bq32k_sysfs_unregister(struct device *dev)
	device_remove_file(dev, &dev_attr_trickle_charge_bypass);
}

static int bq32k_probe(struct i2c_client *client,
				const struct i2c_device_id *id)
static int bq32k_probe(struct i2c_client *client)
{
	struct device *dev = &client->dev;
	struct rtc_device *rtc;
@@ -322,7 +321,7 @@ static struct i2c_driver bq32k_driver = {
		.name	= "bq32k",
		.of_match_table = of_match_ptr(bq32k_of_match),
	},
	.probe		= bq32k_probe,
	.probe_new	= bq32k_probe,
	.remove		= bq32k_remove,
	.id_table	= bq32k_id,
};
+2 −3
Original line number Diff line number Diff line
@@ -467,8 +467,7 @@ static const struct watchdog_ops ds1374_wdt_ops = {
 *
 *****************************************************************************
 */
static int ds1374_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
static int ds1374_probe(struct i2c_client *client)
{
	struct ds1374 *ds1374;
	int ret;
@@ -575,7 +574,7 @@ static struct i2c_driver ds1374_driver = {
		.of_match_table = of_match_ptr(ds1374_of_match),
		.pm = &ds1374_pm,
	},
	.probe = ds1374_probe,
	.probe_new = ds1374_probe,
	.remove = ds1374_remove,
	.id_table = ds1374_id,
};
+2 −3
Original line number Diff line number Diff line
@@ -106,8 +106,7 @@ static const struct rtc_class_ops ds1672_rtc_ops = {
	.set_time = ds1672_set_time,
};

static int ds1672_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
static int ds1672_probe(struct i2c_client *client)
{
	int err = 0;
	struct rtc_device *rtc;
@@ -150,7 +149,7 @@ static struct i2c_driver ds1672_driver = {
		   .name = "rtc-ds1672",
		   .of_match_table = of_match_ptr(ds1672_of_match),
	},
	.probe = &ds1672_probe,
	.probe_new = ds1672_probe,
	.id_table = ds1672_id,
};

Loading