linux-arm-kernel.lists.infradead.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; 12+ 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ 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; 12+ 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ 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
  2023-06-08  9:42   ` Markus Elfring
  2 siblings, 0 replies; 12+ 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>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ 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; 12+ 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>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ 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
  2023-06-08  9:42   ` Markus Elfring
  2 siblings, 0 replies; 12+ 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.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ 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; 12+ 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.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ 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
@ 2023-06-08  9:42   ` Markus Elfring
  2023-06-08 11:24     ` Wolfram Sang
  2 siblings, 1 reply; 12+ messages in thread
From: Markus Elfring @ 2023-06-08  9:42 UTC (permalink / raw)
  To: Andrew Davis, Bartosz Golaszewski, Wolfram Sang, linux-i2c,
	linux-arm-kernel, kernel-janitors
  Cc: LKML

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

https://lore.kernel.org/linux-i2c/20230515175042.495377-2-afd@ti.com/
http://patchwork.ozlabs.org/project/linux-i2c/patch/20230515175042.495377-2-afd@ti.com/

I find that this change approach does not fit to the known requirement
“Solve only one problem per patch.”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.4-rc5#n81

Should desirable changes be split into better update steps?

See also:
[PATCH 0/2] I2C-DaVinci: Adjustments for davinci_i2c_probe()
https://lore.kernel.org/linux-i2c/4e668c87-65f5-8a00-132a-0184779faa08@users.sourceforge.net/
https://lkml.org/lkml/2018/2/2/541

* [1/2] i2c-davinci: Delete an error message for a failed memory allocation in davinci_i2c_probe()
  https://patchwork.ozlabs.org/project/linux-i2c/patch/f890924b-ca68-253b-a7c8-fce269393867@users.sourceforge.net/

* [2/2] i2c-davinci: Improve a size determination in davinci_i2c_probe()
  https://patchwork.ozlabs.org/project/linux-i2c/patch/e16ba754-078a-097a-7333-076f43718645@users.sourceforge.net/

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-06-08  9:42   ` Markus Elfring
@ 2023-06-08 11:24     ` Wolfram Sang
  2023-06-08 11:30       ` [v2 " Markus Elfring
  0 siblings, 1 reply; 12+ 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.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-06-08 11:24     ` Wolfram Sang
@ 2023-06-08 11:30       ` Markus Elfring
  2023-06-08 13:37         ` Wolfram Sang
  0 siblings, 1 reply; 12+ messages in thread
From: Markus Elfring @ 2023-06-08 11:30 UTC (permalink / raw)
  To: Wolfram Sang, Andrew Davis, Bartosz Golaszewski, linux-i2c,
	linux-arm-kernel, kernel-janitors
  Cc: LKML

>> Should desirable changes be split into better update steps?
>
> It is done. It has already been applied.

Will the patch review attention grow anyhow for affected aspects?

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-06-08 11:30       ` [v2 " Markus Elfring
@ 2023-06-08 13:37         ` Wolfram Sang
  2023-06-08 18:46           ` Markus Elfring
  0 siblings, 1 reply; 12+ 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.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [v2 2/2] i2c: davinci: Use struct name not type with devm_kzalloc()
  2023-06-08 13:37         ` Wolfram Sang
@ 2023-06-08 18:46           ` Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: Markus Elfring @ 2023-06-08 18:46 UTC (permalink / raw)
  To: Wolfram Sang, Andrew Davis, Bartosz Golaszewski, linux-i2c,
	linux-arm-kernel, kernel-janitors
  Cc: LKML

>> Will the patch review attention grow anyhow for affected aspects?
>
> What are "affected aspects" in this case?

Example:
Linux patch requirements and corresponding coding style variations

Regards,
Markus

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ 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; 12+ 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.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

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

Thread overview: 12+ 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
2023-06-08  9:42   ` Markus Elfring
2023-06-08 11:24     ` Wolfram Sang
2023-06-08 11:30       ` [v2 " Markus Elfring
2023-06-08 13:37         ` Wolfram Sang
2023-06-08 18:46           ` Markus Elfring
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).