linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] MFD fixes for v5.12
@ 2021-03-25 16:33 Lee Jones
  2021-03-25 18:23 ` Linus Torvalds
  2021-03-25 19:13 ` pr-tracker-bot
  0 siblings, 2 replies; 4+ messages in thread
From: Lee Jones @ 2021-03-25 16:33 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List

Good afternoon Linus,

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/mfd-fixes-5.12

for you to fetch changes up to a61f4661fba404418a7c77e86586dc52a58a93c6:

  mfd: intel_quark_i2c_gpio: Revert "Constify static struct resources" (2021-03-23 09:14:12 +0000)

----------------------------------------------------------------
 - Bug Fixes
   - Unconstify editable placeholder structures

----------------------------------------------------------------
Andy Shevchenko (1):
      mfd: intel_quark_i2c_gpio: Revert "Constify static struct resources"

 drivers/mfd/intel_quark_i2c_gpio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [GIT PULL] MFD fixes for v5.12
  2021-03-25 16:33 [GIT PULL] MFD fixes for v5.12 Lee Jones
@ 2021-03-25 18:23 ` Linus Torvalds
  2021-03-25 18:37   ` Andy Shevchenko
  2021-03-25 19:13 ` pr-tracker-bot
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2021-03-25 18:23 UTC (permalink / raw)
  To: Lee Jones, Andy Shevchenko; +Cc: Linux Kernel Mailing List

On Thu, Mar 25, 2021 at 9:34 AM Lee Jones <lee.jones@linaro.org> wrote:
>
>    - Unconstify editable placeholder structures

Hmm. This does show a real issue with that gpio driver.

It does garbage things:

  static int intel_quark_gpio_setup(struct pci_dev *pdev, struct mfd_cell *cell)
  {
        struct dwapb_platform_data *pdata;
        struct resource *res = (struct resource *)cell->resources;

where that cast is exactly because "cell->resources" _is_ const, and
the driver violates that.

This horrible mis-use of a const pointer is why the original patch
that got reverted didn't cause build-time warnings.

Honestly, I think the right thing to do is to get rid of that cast, and do

        struct resource *res = intel_quark_mfd_cells;

instead, so that you clearly edit somethign that isn't const, and so
that the compiler would have warned about the whole constification in
the first place.

This broken pattern shows up for both intel_quark_i2c_setup() and
intel_quark_gpio_setup().

I've pulled this, but I really want this kind of "take a const pointer
and violate it" crap removed. It is *only* correct if you know exactly
which pointer it is, and then you should just have used that original
pointer in the first place (ie use that intel_quark_mfd_cells[]
directly like suggested above).

           Linus

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

* Re: [GIT PULL] MFD fixes for v5.12
  2021-03-25 18:23 ` Linus Torvalds
@ 2021-03-25 18:37   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-03-25 18:37 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Lee Jones, Linux Kernel Mailing List

On Thu, Mar 25, 2021 at 11:23:06AM -0700, Linus Torvalds wrote:
> On Thu, Mar 25, 2021 at 9:34 AM Lee Jones <lee.jones@linaro.org> wrote:
> >
> >    - Unconstify editable placeholder structures
> 
> Hmm. This does show a real issue with that gpio driver.
> 
> It does garbage things:
> 
>   static int intel_quark_gpio_setup(struct pci_dev *pdev, struct mfd_cell *cell)
>   {
>         struct dwapb_platform_data *pdata;
>         struct resource *res = (struct resource *)cell->resources;
> 
> where that cast is exactly because "cell->resources" _is_ const, and
> the driver violates that.
> 
> This horrible mis-use of a const pointer is why the original patch
> that got reverted didn't cause build-time warnings.
> 
> Honestly, I think the right thing to do is to get rid of that cast, and do
> 
>         struct resource *res = intel_quark_mfd_cells;
> 
> instead, so that you clearly edit somethign that isn't const, and so
> that the compiler would have warned about the whole constification in
> the first place.
> 
> This broken pattern shows up for both intel_quark_i2c_setup() and
> intel_quark_gpio_setup().
> 
> I've pulled this, but I really want this kind of "take a const pointer
> and violate it" crap removed. It is *only* correct if you know exactly
> which pointer it is, and then you should just have used that original
> pointer in the first place (ie use that intel_quark_mfd_cells[]
> directly like suggested above).

Thanks for pointing this out! I'll take it in my TODO list.

Hmm... I missed the above b/c I have seen the pattern of supplying non-const
data structures via .driver_data field and thought that here is something
similar without looking into the actual approach.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [GIT PULL] MFD fixes for v5.12
  2021-03-25 16:33 [GIT PULL] MFD fixes for v5.12 Lee Jones
  2021-03-25 18:23 ` Linus Torvalds
@ 2021-03-25 19:13 ` pr-tracker-bot
  1 sibling, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2021-03-25 19:13 UTC (permalink / raw)
  To: Lee Jones; +Cc: Linus Torvalds, Linux Kernel Mailing List

The pull request you sent on Thu, 25 Mar 2021 16:33:58 +0000:

> git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/mfd-fixes-5.12

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/58e4b9de9d98599d539ad71c7c31f53c0d1f5aba

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

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

end of thread, other threads:[~2021-03-25 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 16:33 [GIT PULL] MFD fixes for v5.12 Lee Jones
2021-03-25 18:23 ` Linus Torvalds
2021-03-25 18:37   ` Andy Shevchenko
2021-03-25 19:13 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).