linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias
@ 2023-05-15 17:50 Andrew Davis
  2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andrew Davis @ 2023-05-15 17:50 UTC (permalink / raw)
  To: Wolfram Sang, Bartosz Golaszewski
  Cc: linux-arm-kernel, linux-i2c, linux-kernel, Andrew Davis

Generates the same platform module alias. More standard usage.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/i2c/busses/i2c-davinci.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 9750310f2c96..c55bd937def7 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -940,12 +940,16 @@ static const struct dev_pm_ops davinci_i2c_pm = {
 #define davinci_i2c_pm_ops NULL
 #endif
 
-/* work with hotplug and coldplug */
-MODULE_ALIAS("platform:i2c_davinci");
+static const struct platform_device_id davinci_i2c_driver_ids[] = {
+	{ .name = "i2c_davinci", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(platform, davinci_i2c_driver_ids);
 
 static struct platform_driver davinci_i2c_driver = {
 	.probe		= davinci_i2c_probe,
 	.remove		= davinci_i2c_remove,
+	.id_table	= davinci_i2c_driver_ids,
 	.driver		= {
 		.name	= "i2c_davinci",
 		.pm	= davinci_i2c_pm_ops,
-- 
2.39.2


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

* [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-05-15 17:50 [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Andrew Davis
@ 2023-05-15 17:50 ` Andrew Davis
  2023-05-16 14:45   ` Bartosz Golaszewski
                     ` (2 more replies)
  2023-05-16 14:46 ` [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Bartosz Golaszewski
  2023-06-07  9:32 ` Wolfram Sang
  2 siblings, 3 replies; 9+ messages in thread
From: Andrew Davis @ 2023-05-15 17:50 UTC (permalink / raw)
  To: Wolfram Sang, Bartosz Golaszewski
  Cc: linux-arm-kernel, linux-i2c, linux-kernel, Andrew Davis

This reduces chance of error if the type of "dev" changes. While here
remove extra error print out, this is not usually done for memory
allocation failures.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/i2c/busses/i2c-davinci.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index c55bd937def7..135f76593e6f 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
 
-	dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
-			GFP_KERNEL);
-	if (!dev) {
-		dev_err(&pdev->dev, "Memory allocation failed\n");
+	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+	if (!dev)
 		return -ENOMEM;
-	}
 
 	init_completion(&dev->cmd_complete);
 
-- 
2.39.2


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

* Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
@ 2023-05-16 14:45   ` Bartosz Golaszewski
  2023-06-07  9:29   ` Wolfram Sang
       [not found]   ` <61846ef5-26fb-52bf-11a3-b1c0b3b53b94@web.de>
  2 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-05-16 14:45 UTC (permalink / raw)
  To: Andrew Davis; +Cc: Wolfram Sang, linux-arm-kernel, linux-i2c, linux-kernel

On Mon, May 15, 2023 at 7:50 PM Andrew Davis <afd@ti.com> wrote:
>
> This reduces chance of error if the type of "dev" changes. While here
> remove extra error print out, this is not usually done for memory
> allocation failures.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/i2c/busses/i2c-davinci.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index c55bd937def7..135f76593e6f 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
>         if (irq < 0)
>                 return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
>
> -       dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
> -                       GFP_KERNEL);
> -       if (!dev) {
> -               dev_err(&pdev->dev, "Memory allocation failed\n");
> +       dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> +       if (!dev)
>                 return -ENOMEM;
> -       }
>
>         init_completion(&dev->cmd_complete);
>
> --
> 2.39.2
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

* Re: [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias
  2023-05-15 17:50 [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Andrew Davis
  2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
@ 2023-05-16 14:46 ` Bartosz Golaszewski
  2023-06-07  9:32 ` Wolfram Sang
  2 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2023-05-16 14:46 UTC (permalink / raw)
  To: Andrew Davis; +Cc: Wolfram Sang, linux-arm-kernel, linux-i2c, linux-kernel

On Mon, May 15, 2023 at 7:50 PM Andrew Davis <afd@ti.com> wrote:
>
> Generates the same platform module alias. More standard usage.
>
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
>  drivers/i2c/busses/i2c-davinci.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 9750310f2c96..c55bd937def7 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -940,12 +940,16 @@ static const struct dev_pm_ops davinci_i2c_pm = {
>  #define davinci_i2c_pm_ops NULL
>  #endif
>
> -/* work with hotplug and coldplug */
> -MODULE_ALIAS("platform:i2c_davinci");
> +static const struct platform_device_id davinci_i2c_driver_ids[] = {
> +       { .name = "i2c_davinci", },
> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(platform, davinci_i2c_driver_ids);
>
>  static struct platform_driver davinci_i2c_driver = {
>         .probe          = davinci_i2c_probe,
>         .remove         = davinci_i2c_remove,
> +       .id_table       = davinci_i2c_driver_ids,
>         .driver         = {
>                 .name   = "i2c_davinci",
>                 .pm     = davinci_i2c_pm_ops,
> --
> 2.39.2
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

* Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
  2023-05-16 14:45   ` Bartosz Golaszewski
@ 2023-06-07  9:29   ` Wolfram Sang
       [not found]   ` <61846ef5-26fb-52bf-11a3-b1c0b3b53b94@web.de>
  2 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-06-07  9:29 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Bartosz Golaszewski, linux-arm-kernel, linux-i2c, linux-kernel

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

On Mon, May 15, 2023 at 12:50:42PM -0500, Andrew Davis wrote:
> This reduces chance of error if the type of "dev" changes. While here
> remove extra error print out, this is not usually done for memory
> allocation failures.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>

Applied to for-next, thanks!


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

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

* Re: [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias
  2023-05-15 17:50 [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Andrew Davis
  2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
  2023-05-16 14:46 ` [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Bartosz Golaszewski
@ 2023-06-07  9:32 ` Wolfram Sang
  2023-06-23  8:27   ` Wolfram Sang
  2 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-06-07  9:32 UTC (permalink / raw)
  To: Andrew Davis
  Cc: Bartosz Golaszewski, linux-arm-kernel, linux-i2c, linux-kernel

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

Hi Andrew,

On Mon, May 15, 2023 at 12:50:41PM -0500, Andrew Davis wrote:
> Generates the same platform module alias. More standard usage.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>

Could you kindly rebase this to my i2c/for-mergewindow branch? It seems
it conflicts with the "callback returning void" conversion.

Thanks,

   Wolfram


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

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

* Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
       [not found]   ` <61846ef5-26fb-52bf-11a3-b1c0b3b53b94@web.de>
@ 2023-06-08 11:24     ` Wolfram Sang
       [not found]       ` <d210abe3-7a9d-61fd-c358-dd4b2c8f2f60@web.de>
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2023-06-08 11:24 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Andrew Davis, Bartosz Golaszewski, linux-i2c, linux-arm-kernel,
	kernel-janitors, LKML

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


> Should desirable changes be split into better update steps?

It is done. It has already been applied.


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

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

* Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
       [not found]       ` <d210abe3-7a9d-61fd-c358-dd4b2c8f2f60@web.de>
@ 2023-06-08 13:37         ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-06-08 13:37 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Andrew Davis, Bartosz Golaszewski, linux-i2c, linux-arm-kernel,
	kernel-janitors, LKML

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


> Will the patch review attention grow anyhow for affected aspects?

What are "affected aspects" in this case?


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

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

* Re: [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias
  2023-06-07  9:32 ` Wolfram Sang
@ 2023-06-23  8:27   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2023-06-23  8:27 UTC (permalink / raw)
  To: Andrew Davis, Bartosz Golaszewski, linux-arm-kernel, linux-i2c,
	linux-kernel

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

On Wed, Jun 07, 2023 at 11:32:38AM +0200, Wolfram Sang wrote:
> Hi Andrew,
> 
> On Mon, May 15, 2023 at 12:50:41PM -0500, Andrew Davis wrote:
> > Generates the same platform module alias. More standard usage.
> > 
> > Signed-off-by: Andrew Davis <afd@ti.com>
> 
> Could you kindly rebase this to my i2c/for-mergewindow branch? It seems
> it conflicts with the "callback returning void" conversion.

I did this now and applied to for-next, thanks!


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

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

end of thread, other threads:[~2023-06-23  8:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15 17:50 [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Andrew Davis
2023-05-15 17:50 ` [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc() Andrew Davis
2023-05-16 14:45   ` Bartosz Golaszewski
2023-06-07  9:29   ` Wolfram Sang
     [not found]   ` <61846ef5-26fb-52bf-11a3-b1c0b3b53b94@web.de>
2023-06-08 11:24     ` Wolfram Sang
     [not found]       ` <d210abe3-7a9d-61fd-c358-dd4b2c8f2f60@web.de>
2023-06-08 13:37         ` [v2 " Wolfram Sang
2023-05-16 14:46 ` [PATCH v2 1/2] i2c: davinci: Use platform table macro over module_alias Bartosz Golaszewski
2023-06-07  9:32 ` Wolfram Sang
2023-06-23  8:27   ` Wolfram Sang

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).