[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZNFx7FfmmrMMZdmv@shell.armlinux.org.uk>
Date: Mon, 7 Aug 2023 23:36:28 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Andrei Coardos <aboutphysycs@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-rtc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
alexandre.belloni@...tlin.com, a.zummo@...ertech.it,
sebastian.hesselbarth@...il.com, gregory.clement@...tlin.com,
andrew@...n.ch, alex@...uggie.ro
Subject: Re: [PATCH] rtc: armada38x: remove unneeded call to
platform_set_drvdata()
On Mon, Aug 07, 2023 at 03:48:11PM +0300, Andrei Coardos wrote:
> This function call was found to be unnecessary as there is no equivalent
> platform_get_drvdata() call to access the private data of the driver. Also,
> the private data is defined in this driver, so there is no risk of it being
> accessed outside of this driver file.
I hope you're not going about doing this _broken_ thing and thinking
"if there's no platform_get_drvdata(), then there shouldn't be any
platform_set_drvdata()" because that is WRONG. Wrong wrong wrong wrong
wrong.
platform_set_drvdata(pdev, foo);
sets the driver data on dev, and is basically implemented as:
dev_set_drvdata(&pdev->dev, foo);
So, to access the driver data, one can either use:
platform_get_drvdata(pdev)
or:
dev_get_drvdata(dev)
where one is dealing with a "struct device" pointer. So, the lack of
any platform_get_drvdata() does *NOT* mean that platform_set_drvdata()
can be removed.
If that's what you've been doing, you are *creating* bugs - and you
need to stop until you properly understand what you are doing.
Thanks anyway, but... your change is totally wrong and will wreck the
driver, causing it to oops the kernel.
Strong and definite NAK.
I do *NOT* expect to ever see a patch like this again for this driver.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists