public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] hwmon: (pmbus/mp2975) Refactor the driver
@ 2024-03-25 12:07 Andy Shevchenko
  2024-03-25 12:07 ` [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit() Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 12:07 UTC (permalink / raw)
  To: Guenter Roeck, Patrick Rudolph, linux-hwmon, linux-kernel
  Cc: Jean Delvare, Andy Shevchenko

Cleanups and refactoring to make it OF-independent (by compilation).
of_device.h is target to remove for the cases where it's not needed,
hende the last patch, which also makes code cleaner.

Andy Shevchenko (3):
  hwmon: (pmbus/mp2975) Replace home made version of __assign_bit()
  hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info
  hwmon: (pmbus/mp2975) Use i2c_get_match_data()

 drivers/hwmon/pmbus/mp2975.c | 89 ++++++++++++++++++++----------------
 1 file changed, 49 insertions(+), 40 deletions(-)

-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit()
  2024-03-25 12:07 [PATCH v1 0/3] hwmon: (pmbus/mp2975) Refactor the driver Andy Shevchenko
@ 2024-03-25 12:07 ` Andy Shevchenko
  2024-03-25 16:29   ` Guenter Roeck
  2024-03-25 12:07 ` [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info Andy Shevchenko
  2024-03-25 12:07 ` [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data() Andy Shevchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 12:07 UTC (permalink / raw)
  To: Guenter Roeck, Patrick Rudolph, linux-hwmon, linux-kernel
  Cc: Jean Delvare, Andy Shevchenko

The newly introduced SWAP() macro is quite generic by naming, but
moreover it's a repetition of the existing __assign_bit().
With this applied, add a missing bits.h (via now required bitops.h).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hwmon/pmbus/mp2975.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
index 953c02a2aeb5..af118087c4ee 100644
--- a/drivers/hwmon/pmbus/mp2975.c
+++ b/drivers/hwmon/pmbus/mp2975.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2020 Nvidia Technologies Ltd.
  */
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
@@ -396,7 +397,7 @@ static int mp2973_write_word_data(struct i2c_client *client, int page,
 				  int reg, u16 word)
 {
 	u8 target, mask;
-	int ret;
+	long ret;
 
 	if (reg != PMBUS_SMBALERT_MASK)
 		return -ENODATA;
@@ -415,7 +416,6 @@ static int mp2973_write_word_data(struct i2c_client *client, int page,
  * Set/Clear 'bit' in 'ret' based on condition followed by define for each bit in SMBALERT_MASK.
  * Also bit 2 & 15 are reserved.
  */
-#define SWAP(val, mask, cond, bit) (((mask) & (cond)) ? ((val) & ~BIT(bit)) : ((val) | BIT(bit)))
 
 #define MP2973_TEMP_OT		0
 #define MP2973_VIN_UVLO		1
@@ -434,36 +434,35 @@ static int mp2973_write_word_data(struct i2c_client *client, int page,
 
 	switch (target) {
 	case PMBUS_STATUS_CML:
-		ret = SWAP(ret, mask, PB_CML_FAULT_INVALID_DATA, MP2973_INVALID_DATA);
-		ret = SWAP(ret, mask, PB_CML_FAULT_INVALID_COMMAND,  MP2973_INVALID_COMMAND);
-		ret = SWAP(ret, mask, PB_CML_FAULT_OTHER_COMM, MP2973_OTHER_COMM);
-		ret = SWAP(ret, mask, PB_CML_FAULT_PACKET_ERROR, MP2973_PACKET_ERROR);
+		__assign_bit(MP2973_INVALID_DATA, &ret, !(mask & PB_CML_FAULT_INVALID_DATA));
+		__assign_bit(MP2973_INVALID_COMMAND, &ret, !(mask & PB_CML_FAULT_INVALID_COMMAND));
+		__assign_bit(MP2973_OTHER_COMM, &ret, !(mask & PB_CML_FAULT_OTHER_COMM));
+		__assign_bit(MP2973_PACKET_ERROR, &ret, !(mask & PB_CML_FAULT_PACKET_ERROR));
 		break;
 	case PMBUS_STATUS_VOUT:
-		ret = SWAP(ret, mask, PB_VOLTAGE_UV_FAULT, MP2973_VOLTAGE_UV);
-		ret = SWAP(ret, mask, PB_VOLTAGE_OV_FAULT, MP2973_VOLTAGE_OV);
+		__assign_bit(MP2973_VOLTAGE_UV, &ret, !(mask & PB_VOLTAGE_UV_FAULT));
+		__assign_bit(MP2973_VOLTAGE_OV, &ret, !(mask & PB_VOLTAGE_OV_FAULT));
 		break;
 	case PMBUS_STATUS_IOUT:
-		ret = SWAP(ret, mask, PB_IOUT_OC_FAULT, MP2973_IOUT_OC);
-		ret = SWAP(ret, mask, PB_IOUT_OC_LV_FAULT, MP2973_IOUT_OC_LV);
+		__assign_bit(MP2973_IOUT_OC, &ret, !(mask & PB_IOUT_OC_FAULT));
+		__assign_bit(MP2973_IOUT_OC_LV, &ret, !(mask & PB_IOUT_OC_LV_FAULT));
 		break;
 	case PMBUS_STATUS_TEMPERATURE:
-		ret = SWAP(ret, mask, PB_TEMP_OT_FAULT, MP2973_TEMP_OT);
+		__assign_bit(MP2973_TEMP_OT, &ret, !(mask & PB_TEMP_OT_FAULT));
 		break;
 	/*
 	 * Map remaining bits to MFR specific to let the PMBUS core mask
 	 * those bits by default.
 	 */
 	case PMBUS_STATUS_MFR_SPECIFIC:
-		ret = SWAP(ret, mask, BIT(1), MP2973_VIN_UVLO);
-		ret = SWAP(ret, mask, BIT(3), MP2973_VIN_OVP);
-		ret = SWAP(ret, mask, BIT(4), MP2973_MTP_FAULT);
-		ret = SWAP(ret, mask, BIT(6), MP2973_MTP_BLK_TRIG);
+		__assign_bit(MP2973_VIN_UVLO, &ret, !(mask & BIT(1)));
+		__assign_bit(MP2973_VIN_OVP, &ret, !(mask & BIT(3)));
+		__assign_bit(MP2973_MTP_FAULT, &ret, !(mask & BIT(4)));
+		__assign_bit(MP2973_MTP_BLK_TRIG, &ret, !(mask & BIT(6)));
 		break;
 	default:
 		return 0;
 	}
-#undef SWAP
 
 	return pmbus_write_word_data(client, 0, PMBUS_SMBALERT_MASK, ret);
 }
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info
  2024-03-25 12:07 [PATCH v1 0/3] hwmon: (pmbus/mp2975) Refactor the driver Andy Shevchenko
  2024-03-25 12:07 ` [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit() Andy Shevchenko
@ 2024-03-25 12:07 ` Andy Shevchenko
  2024-03-25 16:29   ` Guenter Roeck
  2024-03-25 12:07 ` [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data() Andy Shevchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 12:07 UTC (permalink / raw)
  To: Guenter Roeck, Patrick Rudolph, linux-hwmon, linux-kernel
  Cc: Jean Delvare, Andy Shevchenko

Constify the local variables pointing to "struct pmbus_driver_info" and
other encoding params to annotate the function is not modifying pointed
data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hwmon/pmbus/mp2975.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
index af118087c4ee..bc7558dc87ee 100644
--- a/drivers/hwmon/pmbus/mp2975.c
+++ b/drivers/hwmon/pmbus/mp2975.c
@@ -942,7 +942,7 @@ mp2975_vout_per_rail_config_get(struct i2c_client *client,
 	return 0;
 }
 
-static struct pmbus_driver_info mp2975_info = {
+static const struct pmbus_driver_info mp2975_info = {
 	.pages = 1,
 	.format[PSC_VOLTAGE_IN] = linear,
 	.format[PSC_VOLTAGE_OUT] = direct,
@@ -967,7 +967,7 @@ static struct pmbus_driver_info mp2975_info = {
 #endif
 };
 
-static struct pmbus_driver_info mp2973_info = {
+static const struct pmbus_driver_info mp2973_info = {
 	.pages = 1,
 	.format[PSC_VOLTAGE_IN] = linear,
 	.format[PSC_VOLTAGE_OUT] = direct,
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data()
  2024-03-25 12:07 [PATCH v1 0/3] hwmon: (pmbus/mp2975) Refactor the driver Andy Shevchenko
  2024-03-25 12:07 ` [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit() Andy Shevchenko
  2024-03-25 12:07 ` [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info Andy Shevchenko
@ 2024-03-25 12:07 ` Andy Shevchenko
  2024-03-25 16:31   ` Guenter Roeck
  2 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 12:07 UTC (permalink / raw)
  To: Guenter Roeck, Patrick Rudolph, linux-hwmon, linux-kernel
  Cc: Jean Delvare, Andy Shevchenko

Use preferred i2c_get_match_data() instead of of_device_get_match_data()
to get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hwmon/pmbus/mp2975.c | 54 +++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
index bc7558dc87ee..79b4ea325cb2 100644
--- a/drivers/hwmon/pmbus/mp2975.c
+++ b/drivers/hwmon/pmbus/mp2975.c
@@ -10,8 +10,9 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of_device.h>
+
 #include "pmbus.h"
 
 /* Vendor specific registers. */
@@ -98,6 +99,11 @@ static const int mp2975_max_phases[][MP2975_PAGE_NUM] = {
 	[mp2971] = { MP2971_MAX_PHASE_RAIL1, MP2971_MAX_PHASE_RAIL2 },
 };
 
+struct mp2975_driver_info {
+	const struct pmbus_driver_info *info;
+	enum chips chip_id;
+};
+
 struct mp2975_data {
 	struct pmbus_driver_info info;
 	enum chips chip_id;
@@ -111,15 +117,6 @@ struct mp2975_data {
 	int curr_sense_gain[MP2975_PAGE_NUM];
 };
 
-static const struct i2c_device_id mp2975_id[] = {
-	{"mp2971", mp2971},
-	{"mp2973", mp2973},
-	{"mp2975", mp2975},
-	{}
-};
-
-MODULE_DEVICE_TABLE(i2c, mp2975_id);
-
 static const struct regulator_desc __maybe_unused mp2975_reg_desc[] = {
 	PMBUS_REGULATOR("vout", 0),
 	PMBUS_REGULATOR("vout", 1),
@@ -989,29 +986,34 @@ static const struct pmbus_driver_info mp2973_info = {
 #endif
 };
 
+static const struct mp2975_driver_info mp2975_ddinfo[] = {
+	[mp2975] = { .info = &mp2975_info, .chip_id = mp2975 },
+	[mp2973] = { .info = &mp2973_info, .chip_id = mp2973 },
+	[mp2971] = { .info = &mp2973_info, .chip_id = mp2971 },
+};
+
 static int mp2975_probe(struct i2c_client *client)
 {
+	const struct mp2975_driver_info *ddinfo;
 	struct pmbus_driver_info *info;
 	struct mp2975_data *data;
 	int ret;
 
+	ddinfo = i2c_get_match_data(client);
+	if (!ddinfo)
+		return -ENODEV;
+
 	data = devm_kzalloc(&client->dev, sizeof(struct mp2975_data),
 			    GFP_KERNEL);
 	if (!data)
 		return -ENOMEM;
 
-	if (client->dev.of_node)
-		data->chip_id = (enum chips)(unsigned long)of_device_get_match_data(&client->dev);
-	else
-		data->chip_id = i2c_match_id(mp2975_id, client)->driver_data;
+	data->chip_id = ddinfo->chip_id;
 
 	memcpy(data->max_phases, mp2975_max_phases[data->chip_id],
 	       sizeof(data->max_phases));
 
-	if (data->chip_id == mp2975)
-		memcpy(&data->info, &mp2975_info, sizeof(*info));
-	else
-		memcpy(&data->info, &mp2973_info, sizeof(*info));
+	memcpy(&data->info, ddinfo->info, sizeof(data->info));
 
 	info = &data->info;
 
@@ -1070,17 +1072,25 @@ static int mp2975_probe(struct i2c_client *client)
 }
 
 static const struct of_device_id __maybe_unused mp2975_of_match[] = {
-	{.compatible = "mps,mp2971", .data = (void *)mp2971},
-	{.compatible = "mps,mp2973", .data = (void *)mp2973},
-	{.compatible = "mps,mp2975", .data = (void *)mp2975},
+	{.compatible = "mps,mp2971", .data = &mp2975_ddinfo[mp2971]},
+	{.compatible = "mps,mp2973", .data = &mp2975_ddinfo[mp2973]},
+	{.compatible = "mps,mp2975", .data = &mp2975_ddinfo[mp2975]},
 	{}
 };
 MODULE_DEVICE_TABLE(of, mp2975_of_match);
 
+static const struct i2c_device_id mp2975_id[] = {
+	{"mp2971", (kernel_ulong_t)&mp2975_ddinfo[mp2971]},
+	{"mp2973", (kernel_ulong_t)&mp2975_ddinfo[mp2973]},
+	{"mp2975", (kernel_ulong_t)&mp2975_ddinfo[mp2975]},
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, mp2975_id);
+
 static struct i2c_driver mp2975_driver = {
 	.driver = {
 		.name = "mp2975",
-		.of_match_table = of_match_ptr(mp2975_of_match),
+		.of_match_table = mp2975_of_match,
 	},
 	.probe = mp2975_probe,
 	.id_table = mp2975_id,
-- 
2.43.0.rc1.1.gbec44491f096


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit()
  2024-03-25 12:07 ` [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit() Andy Shevchenko
@ 2024-03-25 16:29   ` Guenter Roeck
  2024-03-25 16:34     ` Andy Shevchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2024-03-25 16:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Patrick Rudolph, linux-hwmon, linux-kernel, Jean Delvare

On Mon, Mar 25, 2024 at 02:07:42PM +0200, Andy Shevchenko wrote:
> The newly introduced SWAP() macro is quite generic by naming, but
> moreover it's a repetition of the existing __assign_bit().
> With this applied, add a missing bits.h (via now required bitops.h).
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Not sure if I like __assign_bit() more than SWAP(), but at least it is
"standard". Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info
  2024-03-25 12:07 ` [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info Andy Shevchenko
@ 2024-03-25 16:29   ` Guenter Roeck
  0 siblings, 0 replies; 9+ messages in thread
From: Guenter Roeck @ 2024-03-25 16:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Patrick Rudolph, linux-hwmon, linux-kernel, Jean Delvare

On Mon, Mar 25, 2024 at 02:07:43PM +0200, Andy Shevchenko wrote:
> Constify the local variables pointing to "struct pmbus_driver_info" and
> other encoding params to annotate the function is not modifying pointed
> data.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data()
  2024-03-25 12:07 ` [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data() Andy Shevchenko
@ 2024-03-25 16:31   ` Guenter Roeck
  2024-03-25 16:36     ` Andy Shevchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Guenter Roeck @ 2024-03-25 16:31 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Patrick Rudolph, linux-hwmon, linux-kernel, Jean Delvare

On Mon, Mar 25, 2024 at 02:07:44PM +0200, Andy Shevchenko wrote:
> Use preferred i2c_get_match_data() instead of of_device_get_match_data()
> to get the driver match data. With this, adjust the includes to explicitly
> include the correct headers.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Appied, with additional change noted below.

> ---
>  drivers/hwmon/pmbus/mp2975.c | 54 +++++++++++++++++++++---------------
>  1 file changed, 32 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/mp2975.c b/drivers/hwmon/pmbus/mp2975.c
> index bc7558dc87ee..79b4ea325cb2 100644
> --- a/drivers/hwmon/pmbus/mp2975.c
> +++ b/drivers/hwmon/pmbus/mp2975.c
> @@ -10,8 +10,9 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/kernel.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> -#include <linux/of_device.h>
> +
>  #include "pmbus.h"
>  
>  /* Vendor specific registers. */
> @@ -98,6 +99,11 @@ static const int mp2975_max_phases[][MP2975_PAGE_NUM] = {
>  	[mp2971] = { MP2971_MAX_PHASE_RAIL1, MP2971_MAX_PHASE_RAIL2 },
>  };
>  
> +struct mp2975_driver_info {
> +	const struct pmbus_driver_info *info;
> +	enum chips chip_id;
> +};
> +
>  struct mp2975_data {
>  	struct pmbus_driver_info info;
>  	enum chips chip_id;
> @@ -111,15 +117,6 @@ struct mp2975_data {
>  	int curr_sense_gain[MP2975_PAGE_NUM];
>  };
>  
> -static const struct i2c_device_id mp2975_id[] = {
> -	{"mp2971", mp2971},
> -	{"mp2973", mp2973},
> -	{"mp2975", mp2975},
> -	{}
> -};
> -
> -MODULE_DEVICE_TABLE(i2c, mp2975_id);
> -
>  static const struct regulator_desc __maybe_unused mp2975_reg_desc[] = {
>  	PMBUS_REGULATOR("vout", 0),
>  	PMBUS_REGULATOR("vout", 1),
> @@ -989,29 +986,34 @@ static const struct pmbus_driver_info mp2973_info = {
>  #endif
>  };
>  
> +static const struct mp2975_driver_info mp2975_ddinfo[] = {
> +	[mp2975] = { .info = &mp2975_info, .chip_id = mp2975 },
> +	[mp2973] = { .info = &mp2973_info, .chip_id = mp2973 },
> +	[mp2971] = { .info = &mp2973_info, .chip_id = mp2971 },
> +};
> +
>  static int mp2975_probe(struct i2c_client *client)
>  {
> +	const struct mp2975_driver_info *ddinfo;
>  	struct pmbus_driver_info *info;
>  	struct mp2975_data *data;
>  	int ret;
>  
> +	ddinfo = i2c_get_match_data(client);
> +	if (!ddinfo)
> +		return -ENODEV;
> +
>  	data = devm_kzalloc(&client->dev, sizeof(struct mp2975_data),
>  			    GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
>  
> -	if (client->dev.of_node)
> -		data->chip_id = (enum chips)(unsigned long)of_device_get_match_data(&client->dev);
> -	else
> -		data->chip_id = i2c_match_id(mp2975_id, client)->driver_data;
> +	data->chip_id = ddinfo->chip_id;
>  
>  	memcpy(data->max_phases, mp2975_max_phases[data->chip_id],
>  	       sizeof(data->max_phases));
>  
> -	if (data->chip_id == mp2975)
> -		memcpy(&data->info, &mp2975_info, sizeof(*info));
> -	else
> -		memcpy(&data->info, &mp2973_info, sizeof(*info));
> +	memcpy(&data->info, ddinfo->info, sizeof(data->info));
>  
>  	info = &data->info;
>  
> @@ -1070,17 +1072,25 @@ static int mp2975_probe(struct i2c_client *client)
>  }
>  
>  static const struct of_device_id __maybe_unused mp2975_of_match[] = {

This is no longer __maybe_unused.

Thanks,
Guenter

> -	{.compatible = "mps,mp2971", .data = (void *)mp2971},
> -	{.compatible = "mps,mp2973", .data = (void *)mp2973},
> -	{.compatible = "mps,mp2975", .data = (void *)mp2975},
> +	{.compatible = "mps,mp2971", .data = &mp2975_ddinfo[mp2971]},
> +	{.compatible = "mps,mp2973", .data = &mp2975_ddinfo[mp2973]},
> +	{.compatible = "mps,mp2975", .data = &mp2975_ddinfo[mp2975]},
>  	{}
>  };
>  MODULE_DEVICE_TABLE(of, mp2975_of_match);
>  
> +static const struct i2c_device_id mp2975_id[] = {
> +	{"mp2971", (kernel_ulong_t)&mp2975_ddinfo[mp2971]},
> +	{"mp2973", (kernel_ulong_t)&mp2975_ddinfo[mp2973]},
> +	{"mp2975", (kernel_ulong_t)&mp2975_ddinfo[mp2975]},
> +	{}
> +};
> +MODULE_DEVICE_TABLE(i2c, mp2975_id);
> +
>  static struct i2c_driver mp2975_driver = {
>  	.driver = {
>  		.name = "mp2975",
> -		.of_match_table = of_match_ptr(mp2975_of_match),
> +		.of_match_table = mp2975_of_match,
>  	},
>  	.probe = mp2975_probe,
>  	.id_table = mp2975_id,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit()
  2024-03-25 16:29   ` Guenter Roeck
@ 2024-03-25 16:34     ` Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 16:34 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Patrick Rudolph, linux-hwmon, linux-kernel, Jean Delvare

On Mon, Mar 25, 2024 at 09:29:11AM -0700, Guenter Roeck wrote:
> On Mon, Mar 25, 2024 at 02:07:42PM +0200, Andy Shevchenko wrote:
> > The newly introduced SWAP() macro is quite generic by naming, but
> > moreover it's a repetition of the existing __assign_bit().
> > With this applied, add a missing bits.h (via now required bitops.h).
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Not sure if I like __assign_bit() more than SWAP(),

To add to the mess, we have swap() already defined globally.
This one steps on our toes.

> but at least it is "standard". Applied.

Thank you!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data()
  2024-03-25 16:31   ` Guenter Roeck
@ 2024-03-25 16:36     ` Andy Shevchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-03-25 16:36 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Patrick Rudolph, linux-hwmon, linux-kernel, Jean Delvare

On Mon, Mar 25, 2024 at 09:31:08AM -0700, Guenter Roeck wrote:
> On Mon, Mar 25, 2024 at 02:07:44PM +0200, Andy Shevchenko wrote:

...

> >  static const struct of_device_id __maybe_unused mp2975_of_match[] = {
> 
> This is no longer __maybe_unused.

True, thank you!

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-03-25 16:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-25 12:07 [PATCH v1 0/3] hwmon: (pmbus/mp2975) Refactor the driver Andy Shevchenko
2024-03-25 12:07 ` [PATCH v1 1/3] hwmon: (pmbus/mp2975) Replace home made version of __assign_bit() Andy Shevchenko
2024-03-25 16:29   ` Guenter Roeck
2024-03-25 16:34     ` Andy Shevchenko
2024-03-25 12:07 ` [PATCH v1 2/3] hwmon: (pmbus/mp2975) Constify local pointers to pmbus_driver_info Andy Shevchenko
2024-03-25 16:29   ` Guenter Roeck
2024-03-25 12:07 ` [PATCH v1 3/3] hwmon: (pmbus/mp2975) Use i2c_get_match_data() Andy Shevchenko
2024-03-25 16:31   ` Guenter Roeck
2024-03-25 16:36     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox