[PATCH 1/2] ARM: mx28evk: remove flexcan_pdata __initconst attribute

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Fri Nov 11 10:42:43 EST 2011


On Fri, Nov 11, 2011 at 03:25:01PM +0000, Dong Aisheng-B29396 wrote:
> > -----Original Message-----
> > From: Uwe Kleine-König [mailto:u.kleine-koenig at pengutronix.de]
> > Sent: Friday, November 11, 2011 11:06 PM
> > To: Dong Aisheng-B29396
> > Cc: linux-arm-kernel at lists.infradead.org; kernel at pengutronix.de;
> > s.hauer at pengutronix.de; w.sang at pengutronix.de; Guo Shawn-R65073
> > Subject: Re: [PATCH 1/2] ARM: mx28evk: remove flexcan_pdata __initconst
> > attribute
> > 
> > On Fri, Nov 11, 2011 at 11:12:39PM +0800, Dong Aisheng wrote:
> > > The flexcan driver still uses it after init.
> > As "it" is a copy of flexcan_pdata it's completely OK for the driver to
> > use it.
> > 
> > What is the exact problem you want to address?
> >
> Sorry, I just checked the code and found platform_device_add_data will
> Add a copy of platform specific data.
> Originally I thought the driver may access the freed pdata after init.
> 
> So, does it mean that every pdata of pdevice added
> by mxs_add_platform_device_dmamask can be prefixed by __init*?
> 
> And, below change seems correct?
> diff --git a/arch/arm/mach-mxs/module-tx28.c b/arch/arm/mach-mxs/module-tx28.c
> index 0fcff47..a096cca 100644
> --- a/arch/arm/mach-mxs/module-tx28.c
> +++ b/arch/arm/mach-mxs/module-tx28.c
> @@ -66,11 +66,11 @@ static const iomux_cfg_t tx28_fec1_pads[] __initconst = {
>         MX28_PAD_ENET0_CRS__ENET1_RX_EN,
>  };
> 
> -static struct fec_platform_data tx28_fec0_data = {
> +static struct fec_platform_data __initconst tx28_fec0_data = {
>         .phy = PHY_INTERFACE_MODE_RMII,
>  };
> 
> -static struct fec_platform_data tx28_fec1_data = {
> +static struct fec_platform_data __initconst tx28_fec1_data = {
>         .phy = PHY_INTERFACE_MODE_RMII,
>  };
Apart from Russell's objections, yes.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |



More information about the linux-arm-kernel mailing list