* [PATCH 0/2] Add dev_is_amba and replace the usage in platform
@ 2024-09-23 9:42 Kunwu Chan
2024-09-23 9:42 ` [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules Kunwu Chan
2024-09-23 9:42 ` [PATCH 2/2] of/platform: PCI: Use dev_is_platform/dev_is_amba to identify platform/amba devices Kunwu Chan
0 siblings, 2 replies; 9+ messages in thread
From: Kunwu Chan @ 2024-09-23 9:42 UTC (permalink / raw)
To: linux, robh, saravanak; +Cc: linux-kernel, devicetree, Kunwu Chan
Add dev_is_amba function and use dev_is_platform()/dev_is_amba()
instead of checking bus type directly.
Kunwu Chan (2):
amba: Add dev_is_amba() function and export it for modules
of/platform: PCI: Use dev_is_platform/dev_is_amba to identify
platform/amba devices
drivers/amba/bus.c | 6 ++++++
drivers/of/platform.c | 4 ++--
include/linux/amba/bus.h | 5 +++++
3 files changed, 13 insertions(+), 2 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-23 9:42 [PATCH 0/2] Add dev_is_amba and replace the usage in platform Kunwu Chan
@ 2024-09-23 9:42 ` Kunwu Chan
2024-09-23 11:11 ` Andy Shevchenko
2024-09-24 22:28 ` Rob Herring
2024-09-23 9:42 ` [PATCH 2/2] of/platform: PCI: Use dev_is_platform/dev_is_amba to identify platform/amba devices Kunwu Chan
1 sibling, 2 replies; 9+ messages in thread
From: Kunwu Chan @ 2024-09-23 9:42 UTC (permalink / raw)
To: linux, robh, saravanak
Cc: linux-kernel, devicetree, Kunwu Chan, Andy Shevchenko
Add dev_is_amba() function to determine
whether the device is a AMBA device.
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
drivers/amba/bus.c | 6 ++++++
include/linux/amba/bus.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 0230c43377c1..8ef259b4d037 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -449,6 +449,12 @@ const struct bus_type amba_bustype = {
};
EXPORT_SYMBOL_GPL(amba_bustype);
+bool dev_is_amba(const struct device *dev)
+{
+ return dev->bus == &amba_bustype;
+}
+EXPORT_SYMBOL_GPL(dev_is_amba);
+
static int __init amba_init(void)
{
return bus_register(&amba_bustype);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index dda2f3ea89cb..9946276aff73 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -121,6 +121,7 @@ extern const struct bus_type amba_bustype;
#ifdef CONFIG_ARM_AMBA
int __amba_driver_register(struct amba_driver *, struct module *);
void amba_driver_unregister(struct amba_driver *);
+bool dev_is_amba(const struct device *dev);
#else
static inline int __amba_driver_register(struct amba_driver *drv,
struct module *owner)
@@ -130,6 +131,10 @@ static inline int __amba_driver_register(struct amba_driver *drv,
static inline void amba_driver_unregister(struct amba_driver *drv)
{
}
+static inline bool dev_is_amba(const struct device *dev)
+{
+ return false;
+}
#endif
struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] of/platform: PCI: Use dev_is_platform/dev_is_amba to identify platform/amba devices
2024-09-23 9:42 [PATCH 0/2] Add dev_is_amba and replace the usage in platform Kunwu Chan
2024-09-23 9:42 ` [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules Kunwu Chan
@ 2024-09-23 9:42 ` Kunwu Chan
1 sibling, 0 replies; 9+ messages in thread
From: Kunwu Chan @ 2024-09-23 9:42 UTC (permalink / raw)
To: linux, robh, saravanak; +Cc: linux-kernel, devicetree, Kunwu Chan
Use dev_is_platform()/dev_is_amba() instead of checking bus type directly.
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
drivers/of/platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 9bafcff3e628..1937cbef55ee 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -619,10 +619,10 @@ int of_platform_device_destroy(struct device *dev, void *data)
of_node_clear_flag(dev->of_node, OF_POPULATED);
of_node_clear_flag(dev->of_node, OF_POPULATED_BUS);
- if (dev->bus == &platform_bus_type)
+ if (dev_is_platform(dev))
platform_device_unregister(to_platform_device(dev));
#ifdef CONFIG_ARM_AMBA
- else if (dev->bus == &amba_bustype)
+ else if (dev_is_amba(dev))
amba_device_unregister(to_amba_device(dev));
#endif
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-23 9:42 ` [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules Kunwu Chan
@ 2024-09-23 11:11 ` Andy Shevchenko
2024-09-23 11:12 ` Andy Shevchenko
2024-09-24 22:28 ` Rob Herring
1 sibling, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-09-23 11:11 UTC (permalink / raw)
To: Kunwu Chan; +Cc: linux, robh, saravanak, linux-kernel, devicetree
On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
> Add dev_is_amba() function to determine
> whether the device is a AMBA device.
Thanks, but it needs at least a user to show the conversion.
I think I suggested in the last discussion to convert all
straightforward cases (which are not the direct users of the
given bus type).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-23 11:11 ` Andy Shevchenko
@ 2024-09-23 11:12 ` Andy Shevchenko
0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-09-23 11:12 UTC (permalink / raw)
To: Kunwu Chan; +Cc: linux, robh, saravanak, linux-kernel, devicetree
On Mon, Sep 23, 2024 at 02:11:40PM +0300, Andy Shevchenko wrote:
> On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
> > Add dev_is_amba() function to determine
> > whether the device is a AMBA device.
>
> Thanks, but it needs at least a user to show the conversion.
> I think I suggested in the last discussion to convert all
> straightforward cases (which are not the direct users of the
> given bus type).
Okay, I see now, I was only Cc'ed to the first in the series...
Scratch that comment then, sorry for the noise.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-23 9:42 ` [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules Kunwu Chan
2024-09-23 11:11 ` Andy Shevchenko
@ 2024-09-24 22:28 ` Rob Herring
2024-09-24 22:43 ` Russell King (Oracle)
1 sibling, 1 reply; 9+ messages in thread
From: Rob Herring @ 2024-09-24 22:28 UTC (permalink / raw)
To: Kunwu Chan, linux; +Cc: saravanak, linux-kernel, devicetree, Andy Shevchenko
On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
> Add dev_is_amba() function to determine
> whether the device is a AMBA device.
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> ---
> drivers/amba/bus.c | 6 ++++++
> include/linux/amba/bus.h | 5 +++++
> 2 files changed, 11 insertions(+)
Russell, Can I get an ack for this to take it with patch #2.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-24 22:28 ` Rob Herring
@ 2024-09-24 22:43 ` Russell King (Oracle)
2024-09-30 1:39 ` Kunwu Chan
2024-10-02 2:11 ` Rob Herring
0 siblings, 2 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2024-09-24 22:43 UTC (permalink / raw)
To: Rob Herring
Cc: Kunwu Chan, saravanak, linux-kernel, devicetree, Andy Shevchenko
On Tue, Sep 24, 2024 at 05:28:57PM -0500, Rob Herring wrote:
> On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
> > Add dev_is_amba() function to determine
> > whether the device is a AMBA device.
> >
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> > ---
> > drivers/amba/bus.c | 6 ++++++
> > include/linux/amba/bus.h | 5 +++++
> > 2 files changed, 11 insertions(+)
>
> Russell, Can I get an ack for this to take it with patch #2.
Would be nice to discuss "how shall we merge this cross-subsystem
patch series" first, hmm?
The reason I didn't take patch 1 originally is because it was submitted
to me without any users, and the general principle is not to accept
patches without users. Too many times, I've merged code where there's
been a "promise" that it will be used, only to have the author go
silent and users never come along. So now, my rule is... any code that
adds something must also come with its user.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-24 22:43 ` Russell King (Oracle)
@ 2024-09-30 1:39 ` Kunwu Chan
2024-10-02 2:11 ` Rob Herring
1 sibling, 0 replies; 9+ messages in thread
From: Kunwu Chan @ 2024-09-30 1:39 UTC (permalink / raw)
To: Russell King (Oracle), Rob Herring
Cc: saravanak, linux-kernel, devicetree, Andy Shevchenko
Thanks for the reply.
On 2024/9/25 06:43, Russell King (Oracle) wrote:
> On Tue, Sep 24, 2024 at 05:28:57PM -0500, Rob Herring wrote:
>> On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
>>> Add dev_is_amba() function to determine
>>> whether the device is a AMBA device.
>>>
>>> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>>> ---
>>> drivers/amba/bus.c | 6 ++++++
>>> include/linux/amba/bus.h | 5 +++++
>>> 2 files changed, 11 insertions(+)
>> Russell, Can I get an ack for this to take it with patch #2.
> Would be nice to discuss "how shall we merge this cross-subsystem
> patch series" first, hmm?
>
> The reason I didn't take patch 1 originally is because it was submitted
> to me without any users, and the general principle is not to accept
> patches without users. Too many times, I've merged code where there's
> been a "promise" that it will be used, only to have the author go
> silent and users never come along. So now, my rule is... any code that
> adds something must also come with its user.
>
Just one user in drivers/of/platform.c right now.
Actually, I don't know if dev_is_amba will use it more in the future.
So we keep the usage of "dev->bus == &platform_bus_type " too?
Although here come a wrapper function "dev_is_platform".
--
Thanks,
Kunwu.Chan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules
2024-09-24 22:43 ` Russell King (Oracle)
2024-09-30 1:39 ` Kunwu Chan
@ 2024-10-02 2:11 ` Rob Herring
1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2024-10-02 2:11 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Kunwu Chan, saravanak, linux-kernel, devicetree, Andy Shevchenko
On Tue, Sep 24, 2024 at 5:44 PM Russell King (Oracle)
<linux@armlinux.org.uk> wrote:
>
> On Tue, Sep 24, 2024 at 05:28:57PM -0500, Rob Herring wrote:
> > On Mon, Sep 23, 2024 at 05:42:47PM +0800, Kunwu Chan wrote:
> > > Add dev_is_amba() function to determine
> > > whether the device is a AMBA device.
> > >
> > > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
> > > ---
> > > drivers/amba/bus.c | 6 ++++++
> > > include/linux/amba/bus.h | 5 +++++
> > > 2 files changed, 11 insertions(+)
> >
> > Russell, Can I get an ack for this to take it with patch #2.
>
> Would be nice to discuss "how shall we merge this cross-subsystem
> patch series" first, hmm?
Sure. IMO and what seems to be typical, since the user is in
drivers/of/ and changing that code is the overall reason for this
series, I think merging it via the DT tree makes the most sense. But
either way is fine with me. I'm happy to either ack it or apply it and
move on to the next thing.
> The reason I didn't take patch 1 originally is because it was submitted
> to me without any users, and the general principle is not to accept
> patches without users. Too many times, I've merged code where there's
> been a "promise" that it will be used, only to have the author go
> silent and users never come along. So now, my rule is... any code that
> adds something must also come with its user.
The user is in drivers/of/ in patch 2 of this series. So no issue there.
Rob
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-10-02 2:11 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 9:42 [PATCH 0/2] Add dev_is_amba and replace the usage in platform Kunwu Chan
2024-09-23 9:42 ` [PATCH 1/2] amba: Add dev_is_amba() function and export it for modules Kunwu Chan
2024-09-23 11:11 ` Andy Shevchenko
2024-09-23 11:12 ` Andy Shevchenko
2024-09-24 22:28 ` Rob Herring
2024-09-24 22:43 ` Russell King (Oracle)
2024-09-30 1:39 ` Kunwu Chan
2024-10-02 2:11 ` Rob Herring
2024-09-23 9:42 ` [PATCH 2/2] of/platform: PCI: Use dev_is_platform/dev_is_amba to identify platform/amba devices Kunwu Chan
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).