linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] regulator: max20086: Drop ID table
@ 2023-09-10  6:54 Biju Das
  2023-09-26 15:31 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2023-09-10  6:54 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Biju Das, Liam Girdwood, Mark Brown, linux-kernel, Biju Das,
	Andy Shevchenko, Laurent Pinchart

The driver has an ID table, but it uses the wrong API for retrieving match
data and that will lead to a crash, if it is instantiated by user space or
using ID. From this, there is no user for the ID table and let's drop it
from the driver as it saves some memory.

While at it, drop blank lines before MODULE_DEVICE_TABLE* and remove
trailing comma in the terminator entry for OF table making code robust
against (theoretical) misrebases or other similar things where the new
entry goes _after_ the termination without the compiler noticing.

Suggested-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
Note:
 This patch is only compile tested.

v2->v3:
 * Dropped ID table
 * Updated cpmmit header and description.
 * Added Suggested-by tag from Laurent.
v1->v2:
 * Removed trailing comma in the terminator entry for OF/ID table.
---
 drivers/regulator/max20086-regulator.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/regulator/max20086-regulator.c b/drivers/regulator/max20086-regulator.c
index 32f47b896fd1..0eb0a4fb077f 100644
--- a/drivers/regulator/max20086-regulator.c
+++ b/drivers/regulator/max20086-regulator.c
@@ -275,16 +275,6 @@ static int max20086_i2c_probe(struct i2c_client *i2c)
 	return 0;
 }
 
-static const struct i2c_device_id max20086_i2c_id[] = {
-	{ "max20086" },
-	{ "max20087" },
-	{ "max20088" },
-	{ "max20089" },
-	{ /* Sentinel */ },
-};
-
-MODULE_DEVICE_TABLE(i2c, max20086_i2c_id);
-
 static const struct of_device_id max20086_dt_ids[] __maybe_unused = {
 	{
 		.compatible = "maxim,max20086",
@@ -311,9 +301,8 @@ static const struct of_device_id max20086_dt_ids[] __maybe_unused = {
 			.num_outputs = 2,
 		}
 	},
-	{ /* Sentinel */ },
+	{ /* Sentinel */ }
 };
-
 MODULE_DEVICE_TABLE(of, max20086_dt_ids);
 
 static struct i2c_driver max20086_regulator_driver = {
@@ -323,7 +312,6 @@ static struct i2c_driver max20086_regulator_driver = {
 		.of_match_table = of_match_ptr(max20086_dt_ids),
 	},
 	.probe = max20086_i2c_probe,
-	.id_table = max20086_i2c_id,
 };
 
 module_i2c_driver(max20086_regulator_driver);
-- 
2.25.1


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

* Re: [PATCH v3] regulator: max20086: Drop ID table
  2023-09-10  6:54 [PATCH v3] regulator: max20086: Drop ID table Biju Das
@ 2023-09-26 15:31 ` Mark Brown
  2023-09-26 15:36   ` Biju Das
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-09-26 15:31 UTC (permalink / raw)
  To: Biju Das
  Cc: Laurent Pinchart, Liam Girdwood, linux-kernel, Biju Das,
	Andy Shevchenko, Laurent Pinchart

[-- Attachment #1: Type: text/plain, Size: 397 bytes --]

On Sun, Sep 10, 2023 at 07:54:44AM +0100, Biju Das wrote:
> The driver has an ID table, but it uses the wrong API for retrieving match
> data and that will lead to a crash, if it is instantiated by user space or
> using ID. From this, there is no user for the ID table and let's drop it
> from the driver as it saves some memory.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* RE: [PATCH v3] regulator: max20086: Drop ID table
  2023-09-26 15:31 ` Mark Brown
@ 2023-09-26 15:36   ` Biju Das
  2023-09-26 15:41     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Biju Das @ 2023-09-26 15:36 UTC (permalink / raw)
  To: Mark Brown
  Cc: Laurent Pinchart, Liam Girdwood, linux-kernel, Biju Das,
	Andy Shevchenko, Laurent Pinchart

Hi Mark,

Thanks for the feedback.

> Subject: Re: [PATCH v3] regulator: max20086: Drop ID table
> 
> On Sun, Sep 10, 2023 at 07:54:44AM +0100, Biju Das wrote:
> > The driver has an ID table, but it uses the wrong API for retrieving
> > match data and that will lead to a crash, if it is instantiated by
> > user space or using ID. From this, there is no user for the ID table
> > and let's drop it from the driver as it saves some memory.
> 
> This doesn't apply against current code, please check and resend.

V2 version is accepted and is in next [1]. So I would like to
drop this patch as there is no harm in supporting both OF/ID
tables. Please let me know if you think otherwise.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20230926&id=9d9cd8e6a4572efa328ef72a83bbc78a39deca37

Cheers,
Biju

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

* Re: [PATCH v3] regulator: max20086: Drop ID table
  2023-09-26 15:36   ` Biju Das
@ 2023-09-26 15:41     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-09-26 15:41 UTC (permalink / raw)
  To: Biju Das
  Cc: Laurent Pinchart, Liam Girdwood, linux-kernel, Biju Das,
	Andy Shevchenko, Laurent Pinchart

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On Tue, Sep 26, 2023 at 03:36:04PM +0000, Biju Das wrote:

> V2 version is accepted and is in next [1]. So I would like to
> drop this patch as there is no harm in supporting both OF/ID
> tables. Please let me know if you think otherwise.

Ah, that's good - I'd just not expired v1 when I applied that.
Supporting ID based matches does seem better.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-09-26 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10  6:54 [PATCH v3] regulator: max20086: Drop ID table Biju Das
2023-09-26 15:31 ` Mark Brown
2023-09-26 15:36   ` Biju Das
2023-09-26 15:41     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).