Thread (6 messages) 6 messages, 3 authors, 2012-06-24

Re: [PATCH RESEND] of: add const to struct of_device_id.data

From: Uwe Kleine-König <hidden>
Date: 2012-06-24 14:43:26
Also in: lkml

Hello Arnd,

On Fri, Jun 22, 2012 at 05:26:22PM +0000, Arnd Bergmann wrote:
On Friday 22 June 2012, Uwe Kleine-König wrote:
quoted
On Thu, Jun 07, 2012 at 12:20:14PM +0200, Uwe Kleine-König wrote:
quoted
Drivers should never need to modify the data of a device id. So it can
be const which in turn allows more consts in the driver.

Signed-off-by: Uwe Kleine-König <redacted>
---
(Cc += lkml + Grant)

Hello,

this might introduce warnings in drivers that access the data member
without using const, so this is definitly merge window material if it is
considered at all.
ping
Sorry for the delayed response. I think the approach is right, but I
am a bit worried about adding warnings for legit code.

A quick test with the defconfigs gave me this error for prima2_defconfig
and kzm9g_defconfig:

/home/arnd/linux-arm/arch/arm/mm/cache-l2x0.c: In function 'l2x0_of_init':
/home/arnd/linux-arm/arch/arm/mm/cache-l2x0.c:573:7: error: assignment discards 'const' qualifier from pointer target type [-Werror]
I already sent a patch for that to rmk's patch system:

	http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=7429/1

Russell commented: 
Sigh, a gmane.org URL.  Which is difficult to dig the thread out of.
Eventually you can.  And I see nothing which suggests that the series
will be applied or, more importantly when it is going to be applied.
Punting this patch until there's better communication.

Russell, I didn't completely get your problem about gmane here. If you
follow the link in the Subject: line, you get a thread view. Does this
address your concerns?

And even without the of: add const to struct of_device_id.data patch
patch using more consts is IMHO nice.
and this one with at91sam9263_defconfig:
/home/arnd/linux-arm/drivers/misc/atmel_tclib.c: In function 'tc_probe':
/home/arnd/linux-arm/drivers/misc/atmel_tclib.c:170:19: error: assignment discards 'const' qualifier from pointer target type [-Werror]

I haven't checked all the defconfigs yet, but I think we should at least
make sure they build fine before applying your patch.
Fine for me, I will come up with a series next week.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help