RE: [PATCH v4 1/2] pinctrl: Add RZ/A2 pin and gpio controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

On Thursday, November 15, 2018, Geert Uytterhoeven wrote:
> > As for validating the values, the only thing I can really check is that:
> >   of_args.args[2] == RZA2_NPINS
> >
> > Of course, now that I say that, I realize that if/when it does come time
> > to expand this driver beyond the 1 SOC that exists today, I will have
> > to stop using that hard coded RZA2_NPINS value...but I'll deal with that
> > when the time comes.
> 
> Not that there is an inherent danger in taking of_args.args[2] without
> validation to support future SoCs without driver changes.
> port_names[] is a fixed size array, so an SoC with more pins will
> cause memory access beyond the end of the array. Possibly there are
> other locations that need to be changed.
> 
> So IMHO it's better to have explicit support for different SoCs using
> different compatible values, so you can store the number of pins in
> of_device_id.data, and validate against that.

I will fill in of_device_id.data with the number of ports for each SOC 
(only 1 SOC today) and then use that number throughout the driver instead 
of the hard coded number.
I'll also check that of_args.args[2] matches of_device_id.data.

Then, it should be real easy to add support for another SOC when it 
comes along. RZ/T1 which has the same controller has ports up to
Port "U" for example.

Chris





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux