Re: [PATCH 2/4] gpio: Introduce ->get_multiple callback

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

 



On Sat, Oct 07, 2017 at 01:23:17PM +0200, Linus Walleij wrote:
> On Wed, Oct 4, 2017 at 10:32 PM, Lukas Wunner <lukas@xxxxxxxxx> wrote:
> > So I'm wondering if the const keyword does more harm than good in this case.
> > Let me know what you think.
> 
> I've had similar experiences.
> 
> I'm not very sensitive about it, do whatever makes most sense to you.
> 
> What is important is that we get get_mutiple() in place.

Yes.  My apologies for the delay.

I've dropped the const qualifier, the rationale for the compiler error
it triggers is given in:

http://c-faq.com/ansi/constmismatch.html

Briefly, it is legal to pass a pointer to non-const if the function
signature specifies const, but not for a pointer-to-pointer, i.e.
a second level of indirection.  The error is supposed to "help" the
developer keep the const promises but I don't find it helpful at all.
It necessitates a cast unless a const struct gpio_desc ** is passed in.
When would that be the case in reality?  Only if the array is statically
declared, but usually the gpio_desc structs are obtained at runtime,
so the the cast would likely *always* be needed.

Thanks,

Lukas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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