Linux CAN drivers development
 help / color / mirror / Atom feed
* [PATCH v1] can: flexcan: Drop unused platform driver data
@ 2026-05-28  9:45 Uwe Kleine-König (The Capable Hub)
  2026-05-28 11:00 ` Marc Kleine-Budde
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-28  9:45 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol; +Cc: linux-can, linux-kernel

No function in the flexcan driver ever accesses the .driver_data member
of its .id_table array as device_get_match_data() returns NULL for
non-of platform devices. So drop that unused assignment.

While touching that array, drop the trailing comma after the terminator
entry.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
Hello,

I found this patch opportunity while working on a cleanup quest that has
unifying platform_device_id arrays as first step.

Best regards
Uwe
 drivers/net/can/flexcan/flexcan-core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index f5d22c61503f..1871def90fe3 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -2077,10 +2077,9 @@ MODULE_DEVICE_TABLE(of, flexcan_of_match);
 static const struct platform_device_id flexcan_id_table[] = {
 	{
 		.name = "flexcan-mcf5441x",
-		.driver_data = (kernel_ulong_t)&fsl_mcf5441x_devtype_data,
 	}, {
 		/* sentinel */
-	},
+	}
 };
 MODULE_DEVICE_TABLE(platform, flexcan_id_table);
 

base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
-- 
2.47.3


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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28  9:45 [PATCH v1] can: flexcan: Drop unused platform driver data Uwe Kleine-König (The Capable Hub)
@ 2026-05-28 11:00 ` Marc Kleine-Budde
  2026-05-28 13:26   ` Uwe Kleine-König (The Capable Hub)
  2026-05-28 11:02 ` Vincent Mailhol
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Marc Kleine-Budde @ 2026-05-28 11:00 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Vincent Mailhol, linux-can, linux-kernel, Rob Herring

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

On 28.05.2026 11:45:39, Uwe Kleine-König (The Capable Hub) wrote:
> No function in the flexcan driver ever accesses the .driver_data member
> of its .id_table array as device_get_match_data() returns NULL for
> non-of platform devices. So drop that unused assignment.
>
> While touching that array, drop the trailing comma after the terminator
> entry.

Does this mean that commit 5e6c3454b405 ("net: can: Use
device_get_match_data()") introduced a regression?

Marc

>
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
> Hello,
>
> I found this patch opportunity while working on a cleanup quest that has
> unifying platform_device_id arrays as first step.
>
> Best regards
> Uwe
>  drivers/net/can/flexcan/flexcan-core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index f5d22c61503f..1871def90fe3 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -2077,10 +2077,9 @@ MODULE_DEVICE_TABLE(of, flexcan_of_match);
>  static const struct platform_device_id flexcan_id_table[] = {
>  	{
>  		.name = "flexcan-mcf5441x",
> -		.driver_data = (kernel_ulong_t)&fsl_mcf5441x_devtype_data,
>  	}, {
>  		/* sentinel */
> -	},
> +	}
>  };
>  MODULE_DEVICE_TABLE(platform, flexcan_id_table);
>
>
> base-commit: e7d700e14934e68f86338c5610cf2ae76798b663
> --
> 2.47.3
>
>

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

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

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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28  9:45 [PATCH v1] can: flexcan: Drop unused platform driver data Uwe Kleine-König (The Capable Hub)
  2026-05-28 11:00 ` Marc Kleine-Budde
@ 2026-05-28 11:02 ` Vincent Mailhol
  2026-05-28 13:29   ` Uwe Kleine-König (The Capable Hub)
  2026-05-29  0:43 ` kernel test robot
  2026-05-29  2:00 ` kernel test robot
  3 siblings, 1 reply; 7+ messages in thread
From: Vincent Mailhol @ 2026-05-28 11:02 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Marc Kleine-Budde
  Cc: linux-can, linux-kernel

On 28/05/2026 at 11:45, Uwe Kleine-König (The Capable Hub) wrote:
> No function in the flexcan driver ever accesses the .driver_data member
> of its .id_table array as device_get_match_data() returns NULL for
> non-of platform devices. So drop that unused assignment.
> 
> While touching that array, drop the trailing comma after the terminator
> entry.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> I found this patch opportunity while working on a cleanup quest that has
> unifying platform_device_id arrays as first step.
> 
> Best regards
> Uwe
>  drivers/net/can/flexcan/flexcan-core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> index f5d22c61503f..1871def90fe3 100644
> --- a/drivers/net/can/flexcan/flexcan-core.c
> +++ b/drivers/net/can/flexcan/flexcan-core.c
> @@ -2077,10 +2077,9 @@ MODULE_DEVICE_TABLE(of, flexcan_of_match);
>  static const struct platform_device_id flexcan_id_table[] = {
>  	{
>  		.name = "flexcan-mcf5441x",
> -		.driver_data = (kernel_ulong_t)&fsl_mcf5441x_devtype_data,

But now, fsl_mcf5441x_devtype_data becomes unused, right? Should this
also be dropped?

>  	}, {
>  		/* sentinel */
> -	},
> +	}>  };
>  MODULE_DEVICE_TABLE(platform, flexcan_id_table);
>  
> 
> base-commit: e7d700e14934e68f86338c5610cf2ae76798b663


Yours sincerely,
Vincent Mailhol


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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28 11:00 ` Marc Kleine-Budde
@ 2026-05-28 13:26   ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-28 13:26 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Vincent Mailhol, linux-can, linux-kernel, Rob Herring,
	Geert Uytterhoeven, linux-m68k

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

Hello Marc,

On Thu, May 28, 2026 at 01:00:15PM +0200, Marc Kleine-Budde wrote:
> On 28.05.2026 11:45:39, Uwe Kleine-König (The Capable Hub) wrote:
> > No function in the flexcan driver ever accesses the .driver_data member
> > of its .id_table array as device_get_match_data() returns NULL for
> > non-of platform devices. So drop that unused assignment.
> >
> > While touching that array, drop the trailing comma after the terminator
> > entry.
> 
> Does this mean that commit 5e6c3454b405 ("net: can: Use
> device_get_match_data()") introduced a regression?

Yes, I'd claim that this commit introduces a null pointer exception when
mcf_flexcan0 (defined in arch/m68k/coldfire/device.c) probes.

Best regards
Uwe

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

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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28 11:02 ` Vincent Mailhol
@ 2026-05-28 13:29   ` Uwe Kleine-König (The Capable Hub)
  0 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-05-28 13:29 UTC (permalink / raw)
  To: Vincent Mailhol; +Cc: Marc Kleine-Budde, linux-can, linux-kernel

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

Hello Vincent,

On Thu, May 28, 2026 at 01:02:20PM +0200, Vincent Mailhol wrote:
> On 28/05/2026 at 11:45, Uwe Kleine-König (The Capable Hub) wrote:
> > No function in the flexcan driver ever accesses the .driver_data member
> > of its .id_table array as device_get_match_data() returns NULL for
> > non-of platform devices. So drop that unused assignment.
> > 
> > While touching that array, drop the trailing comma after the terminator
> > entry.
> > 
> > Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
> > ---
> > Hello,
> > 
> > I found this patch opportunity while working on a cleanup quest that has
> > unifying platform_device_id arrays as first step.
> > 
> > Best regards
> > Uwe
> >  drivers/net/can/flexcan/flexcan-core.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
> > index f5d22c61503f..1871def90fe3 100644
> > --- a/drivers/net/can/flexcan/flexcan-core.c
> > +++ b/drivers/net/can/flexcan/flexcan-core.c
> > @@ -2077,10 +2077,9 @@ MODULE_DEVICE_TABLE(of, flexcan_of_match);
> >  static const struct platform_device_id flexcan_id_table[] = {
> >  	{
> >  		.name = "flexcan-mcf5441x",
> > -		.driver_data = (kernel_ulong_t)&fsl_mcf5441x_devtype_data,
> 
> But now, fsl_mcf5441x_devtype_data becomes unused, right? Should this
> also be dropped?

Indeed. I would have expected that this results in a compiler warning,
but there isn't one for me and I expected that the struct is still
referenced in flexcan_of_match[] but obviously didn't check.

I'll wait with a v2 until the discussion in the neighbour thread in
reply to Marc's review ends.

Best regards
Uwe

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

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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28  9:45 [PATCH v1] can: flexcan: Drop unused platform driver data Uwe Kleine-König (The Capable Hub)
  2026-05-28 11:00 ` Marc Kleine-Budde
  2026-05-28 11:02 ` Vincent Mailhol
@ 2026-05-29  0:43 ` kernel test robot
  2026-05-29  2:00 ` kernel test robot
  3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-05-29  0:43 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Marc Kleine-Budde,
	Vincent Mailhol
  Cc: oe-kbuild-all, linux-can, linux-kernel

Hi Uwe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on e7d700e14934e68f86338c5610cf2ae76798b663]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig-The-Capable-Hub/can-flexcan-Drop-unused-platform-driver-data/20260528-181620
base:   e7d700e14934e68f86338c5610cf2ae76798b663
patch link:    https://lore.kernel.org/r/20260528094540.1867783-2-u.kleine-koenig%40baylibre.com
patch subject: [PATCH v1] can: flexcan: Drop unused platform driver data
config: powerpc-randconfig-001-20260529 (https://download.01.org/0day-ci/archive/20260529/202605290854.3UtkTrpM-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605290854.3UtkTrpM-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605290854.3UtkTrpM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/can/flexcan/flexcan-core.c:296:42: warning: 'fsl_mcf5441x_devtype_data' defined but not used [-Wunused-const-variable=]
     296 | static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = {
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for HOTPLUG_CPU
   Depends on [n]: SMP [=y] && (PPC_PSERIES [=n] || PPC_PMAC [=n] || PPC_POWERNV [=n] || FSL_SOC_BOOKE [=n])
   Selected by [y]:
   - PM_SLEEP_SMP [=y] && SMP [=y] && (ARCH_SUSPEND_POSSIBLE [=y] || ARCH_HIBERNATION_POSSIBLE [=y]) && PM_SLEEP [=y]


vim +/fsl_mcf5441x_devtype_data +296 drivers/net/can/flexcan/flexcan-core.c

4b702878afc375 drivers/net/can/flexcan.c              Marc Kleine-Budde 2020-09-22  295  
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02 @296  static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = {
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  297  	.quirks = FLEXCAN_QUIRK_BROKEN_PERR_STATE |
c5c88591040ee7 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-01-07  298  		FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 |
d945346db1ef41 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-08-11  299  		FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
d945346db1ef41 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-08-11  300  		FLEXCAN_QUIRK_SUPPORT_RX_FIFO,
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  301  };
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  302  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v1] can: flexcan: Drop unused platform driver data
  2026-05-28  9:45 [PATCH v1] can: flexcan: Drop unused platform driver data Uwe Kleine-König (The Capable Hub)
                   ` (2 preceding siblings ...)
  2026-05-29  0:43 ` kernel test robot
@ 2026-05-29  2:00 ` kernel test robot
  3 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2026-05-29  2:00 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Marc Kleine-Budde,
	Vincent Mailhol
  Cc: llvm, oe-kbuild-all, linux-can, linux-kernel

Hi Uwe,

kernel test robot noticed the following build warnings:

[auto build test WARNING on e7d700e14934e68f86338c5610cf2ae76798b663]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig-The-Capable-Hub/can-flexcan-Drop-unused-platform-driver-data/20260528-181620
base:   e7d700e14934e68f86338c5610cf2ae76798b663
patch link:    https://lore.kernel.org/r/20260528094540.1867783-2-u.kleine-koenig%40baylibre.com
patch subject: [PATCH v1] can: flexcan: Drop unused platform driver data
config: i386-buildonly-randconfig-002-20260529 (https://download.01.org/0day-ci/archive/20260529/202605290912.Y77fySxN-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260529/202605290912.Y77fySxN-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605290912.Y77fySxN-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/net/can/flexcan/flexcan-core.c:296:42: warning: unused variable 'fsl_mcf5441x_devtype_data' [-Wunused-const-variable]
     296 | static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = {
         |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +/fsl_mcf5441x_devtype_data +296 drivers/net/can/flexcan/flexcan-core.c

4b702878afc375 drivers/net/can/flexcan.c              Marc Kleine-Budde 2020-09-22  295  
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02 @296  static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = {
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  297  	.quirks = FLEXCAN_QUIRK_BROKEN_PERR_STATE |
c5c88591040ee7 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-01-07  298  		FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 |
d945346db1ef41 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-08-11  299  		FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
d945346db1ef41 drivers/net/can/flexcan/flexcan-core.c Marc Kleine-Budde 2022-08-11  300  		FLEXCAN_QUIRK_SUPPORT_RX_FIFO,
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  301  };
d9cead75b1c66b drivers/net/can/flexcan.c              Angelo Dureghello 2021-07-02  302  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2026-05-29  2:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28  9:45 [PATCH v1] can: flexcan: Drop unused platform driver data Uwe Kleine-König (The Capable Hub)
2026-05-28 11:00 ` Marc Kleine-Budde
2026-05-28 13:26   ` Uwe Kleine-König (The Capable Hub)
2026-05-28 11:02 ` Vincent Mailhol
2026-05-28 13:29   ` Uwe Kleine-König (The Capable Hub)
2026-05-29  0:43 ` kernel test robot
2026-05-29  2:00 ` kernel test robot

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