[PATCH] amba: make amba_bustype constant

Kunwu Chan posted 1 patch 1 year, 5 months ago
drivers/amba/bus.c       | 2 +-
include/linux/amba/bus.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
From: Kunwu Chan <chentao@kylinos.cn>

Since commit d492cc2573a0 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the amba_bustype variable to be a constant
structure as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
---
 drivers/amba/bus.c       | 2 +-
 include/linux/amba/bus.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 34bc880ca20b..0230c43377c1 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -435,7 +435,7 @@ static const struct dev_pm_ops amba_pm = {
  * DMA configuration for platform and AMBA bus is same. So here we reuse
  * platform's DMA config routine.
  */
-struct bus_type amba_bustype = {
+const struct bus_type amba_bustype = {
 	.name		= "amba",
 	.dev_groups	= amba_dev_groups,
 	.match		= amba_match,
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index 958a55bcc708..dda2f3ea89cb 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -105,7 +105,7 @@ enum amba_vendor {
 	AMBA_VENDOR_LSI = 0xb6,
 };
 
-extern struct bus_type amba_bustype;
+extern const struct bus_type amba_bustype;
 
 #define to_amba_device(d)	container_of_const(d, struct amba_device, dev)
 
-- 
2.41.0
Re: [PATCH] amba: make amba_bustype constant
Posted by Russell King (Oracle) 1 year, 5 months ago
On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
> From: Kunwu Chan <chentao@kylinos.cn>
> 
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the amba_bustype variable to be a constant
> structure as well, placing it into read-only memory which can not be
> modified at runtime.

I'm happy with this, but as AMBA bus maintainer, it needs to go to
my patch system. Please see details in my signature. Please also
note that I'm limited in terms of my time in front of the screen at
the moment, so I'm not very responsive at the moment. Thanks.

-- 
*** please note that I probably will only be occasionally responsive
*** for an unknown period of time due to recent eye surgery making
*** reading quite difficult.

RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
On 2024/8/27 21:46, Russell King (Oracle) wrote:
> On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
>> From: Kunwu Chan <chentao@kylinos.cn>
>>
>> Since commit d492cc2573a0 ("driver core: device.h: make struct
>> bus_type a const *"), the driver core can properly handle constant
>> struct bus_type, move the amba_bustype variable to be a constant
>> structure as well, placing it into read-only memory which can not be
>> modified at runtime.
> I'm happy with this, but as AMBA bus maintainer, it needs to go to
> my patch system. Please see details in my signature. Please also
> note that I'm limited in terms of my time in front of the screen at
> the moment, so I'm not very responsive at the moment. Thanks.
>
Thank you very much for your reply.

  I will follow your suggestion and submit the patch to the 
https://www.armlinux.org.uk/,

I have already created an account.

-- 
Thanks,
   Kunwu.Chan

Re: [PATCH] amba: make amba_bustype constant
Posted by Andy Shevchenko 1 year, 5 months ago
On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
> From: Kunwu Chan <chentao@kylinos.cn>
> 
> Since commit d492cc2573a0 ("driver core: device.h: make struct
> bus_type a const *"), the driver core can properly handle constant
> struct bus_type, move the amba_bustype variable to be a constant
> structure as well, placing it into read-only memory which can not be
> modified at runtime.

...

> -extern struct bus_type amba_bustype;
> +extern const struct bus_type amba_bustype;

Can we actually hide this from the outside, i.e. make it static in the C file,
and introduce the dev_is_amba() helper instead?

P.S. You may look at the PNP bus case (some of the latest patches there).

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
On 2024/8/23 21:48, Andy Shevchenko wrote:
> On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
>> From: Kunwu Chan <chentao@kylinos.cn>
>>
>> Since commit d492cc2573a0 ("driver core: device.h: make struct
>> bus_type a const *"), the driver core can properly handle constant
>> struct bus_type, move the amba_bustype variable to be a constant
>> structure as well, placing it into read-only memory which can not be
>> modified at runtime.
> ...
>
>> -extern struct bus_type amba_bustype;
>> +extern const struct bus_type amba_bustype;
> Can we actually hide this from the outside, i.e. make it static in the C file,
> and introduce the dev_is_amba() helper instead?
>
> P.S. You may look at the PNP bus case (some of the latest patches there)

I found it problematic in the process of making changes.

There have some usage of amba_bustype outside the AMBA code ,i.e: 
https://elixir.bootlin.com/linux/v6.10.4/source/drivers/iommu/iommu.c#L155

So, If we make the amba_bustype inside the AMBA code, the outside cannot 
access.

If only internal access is allowed, it will compile and report an error, 
how should I modify it next, and any suggestions?

-- 
Thanks,
   Kunwu.Chan
Re: [PATCH] amba: make amba_bustype constant
Posted by Andy Shevchenko 1 year, 5 months ago
On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
> On 2024/8/23 21:48, Andy Shevchenko wrote:
> > On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:

...

> > > -extern struct bus_type amba_bustype;
> > > +extern const struct bus_type amba_bustype;
> > Can we actually hide this from the outside, i.e. make it static in the C file,
> > and introduce the dev_is_amba() helper instead?
> > 
> > P.S. You may look at the PNP bus case (some of the latest patches there)
> 
> I found it problematic in the process of making changes.
> 
> There have some usage of amba_bustype outside the AMBA code ,i.e:
> https://elixir.bootlin.com/linux/v6.10.4/source/drivers/iommu/iommu.c#L155
> 
> So, If we make the amba_bustype inside the AMBA code, the outside cannot
> access.

Yes, that's the idea.

> If only internal access is allowed, it will compile and report an error, how
> should I modify it next, and any suggestions?

Make it patch series:
1) patch that introduces exported function called dev_is_amba() (1 patch);
2) convert user-by-user (N patches);
3) hide the bus type and make it constant.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
On 2024/8/26 18:40, Andy Shevchenko wrote:
> On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
>> On 2024/8/23 21:48, Andy Shevchenko wrote:
>>> On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
> ...
>
>>>> -extern struct bus_type amba_bustype;
>>>> +extern const struct bus_type amba_bustype;
>>> Can we actually hide this from the outside, i.e. make it static in the C file,
>>> and introduce the dev_is_amba() helper instead?
>>>
>>> P.S. You may look at the PNP bus case (some of the latest patches there)
>> I found it problematic in the process of making changes.
>>
>> There have some usage of amba_bustype outside the AMBA code ,i.e:
>> https://elixir.bootlin.com/linux/v6.10.4/source/drivers/iommu/iommu.c#L155
>>
>> So, If we make the amba_bustype inside the AMBA code, the outside cannot
>> access.
> Yes, that's the idea.
>
>> If only internal access is allowed, it will compile and report an error, how
>> should I modify it next, and any suggestions?
> Make it patch series:
> 1) patch that introduces exported function called dev_is_amba() (1 patch);
> 2) convert user-by-user (N patches);
> 3) hide the bus type and make it constant.
>
Here[1] have many use of  amba_bustype directly outside the drivers/amba

When I try to hide the amba_bustype by move the extern from 
include/linux/amba to drivers/amba,

we find some errors: "error: use of undeclared identifier amba_bustype".

[1] https://elixir.bootlin.com/linux/v6.10.4/A/ident/amba_bustype

-- 
Thanks,
   Kunwu.Chan

Re: [PATCH] amba: make amba_bustype constant
Posted by Andy Shevchenko 1 year, 5 months ago
On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
> On 2024/8/26 18:40, Andy Shevchenko wrote:
> > On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
> > > On 2024/8/23 21:48, Andy Shevchenko wrote:
> > > > On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:

...

> > > > > -extern struct bus_type amba_bustype;
> > > > > +extern const struct bus_type amba_bustype;
> > > > Can we actually hide this from the outside, i.e. make it static in the C file,
> > > > and introduce the dev_is_amba() helper instead?
> > > > 
> > > > P.S. You may look at the PNP bus case (some of the latest patches there)
> > > I found it problematic in the process of making changes.
> > > 
> > > There have some usage of amba_bustype outside the AMBA code ,i.e:
> > > https://elixir.bootlin.com/linux/v6.10.4/source/drivers/iommu/iommu.c#L155
> > > 
> > > So, If we make the amba_bustype inside the AMBA code, the outside cannot
> > > access.
> > Yes, that's the idea.
> > 
> > > If only internal access is allowed, it will compile and report an error, how
> > > should I modify it next, and any suggestions?

(1) vvv

> > Make it patch series:
> > 1) patch that introduces exported function called dev_is_amba() (1 patch);
> > 2) convert user-by-user (N patches);
> > 3) hide the bus type and make it constant.

(1) ^^^

> Here[1] have many use of  amba_bustype directly outside the drivers/amba

Yes.

> When I try to hide the amba_bustype by move the extern from
> include/linux/amba to drivers/amba,
> 
> we find some errors: "error: use of undeclared identifier amba_bustype".

Yes, that's why I put (1) to how solve this as we usually do in the Linux
kernel.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
Thanks for the reply.
On 2024/8/27 21:37, Andy Shevchenko wrote:
> On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
>> On 2024/8/26 18:40, Andy Shevchenko wrote:
>>> On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
>>>> On 2024/8/23 21:48, Andy Shevchenko wrote:
>>>>> On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
> ...
>
>>>>>> -extern struct bus_type amba_bustype;
>>>>>> +extern const struct bus_type amba_bustype;
>>>>> Can we actually hide this from the outside, i.e. make it static in the C file,
>>>>> and introduce the dev_is_amba() helper instead?
>>>>>
>>>>> P.S. You may look at the PNP bus case (some of the latest patches there)
>>>> I found it problematic in the process of making changes.
>>>>
>>>> There have some usage of amba_bustype outside the AMBA code ,i.e:
>>>> https://elixir.bootlin.com/linux/v6.10.4/source/drivers/iommu/iommu.c#L155
>>>>
>>>> So, If we make the amba_bustype inside the AMBA code, the outside cannot
>>>> access.
>>> Yes, that's the idea.
>>>
>>>> If only internal access is allowed, it will compile and report an error, how
>>>> should I modify it next, and any suggestions?
> (1) vvv
>
>>> Make it patch series:
>>> 1) patch that introduces exported function called dev_is_amba() (1 patch)
Done.
>>> 2) convert user-by-user (N patches)

I've no idea about how to modify, such as in iommu.c:

staticconststructbus_type 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/bus_type>*constiommu_buses 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/iommu_buses>[]={
&platform_bus_type 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/platform_bus_type>,
#ifdef CONFIG_PCI 
<https://elixir.bootlin.com/linux/v6.10.4/K/ident/CONFIG_PCI>
&pci_bus_type 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/pci_bus_type>,
#endif
#ifdef CONFIG_ARM_AMBA 
<https://elixir.bootlin.com/linux/v6.10.4/K/ident/CONFIG_ARM_AMBA>
&amba_bustype 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/amba_bustype>, Or in 
arch/arm/mach-highbank/highbank.c#L150 bus_register_notifier 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/bus_register_notifier>(&amba_bustype 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/amba_bustype>,&highbank_amba_nb 
<https://elixir.bootlin.com/linux/v6.10.4/C/ident/highbank_amba_nb>);

>>> 3) hide the bus type and make it constant.

Done.

Move the 'extern struct' to drivers/amba/bus.c introduce some 
compilation errors.

> (1) ^^^
>
>> Here[1] have many use of  amba_bustype directly outside the drivers/amba
> Yes.
>
>> When I try to hide the amba_bustype by move the extern from
>> include/linux/amba to drivers/amba,
>>
>> we find some errors: "error: use of undeclared identifier amba_bustype".
> Yes, that's why I put (1) to how solve this as we usually do in the Linux
> kernel.
>
I check the pnp_bus_type code, it did'nt use it the non-PNP code.

So I thought I should add a patch for dev_is_amba as your suggested and 
just leave it intact and submit it together.

-- 
Thanks,
   Kunwu.Chan

Re: [PATCH] amba: make amba_bustype constant
Posted by Andy Shevchenko 1 year, 5 months ago
On Wed, Aug 28, 2024 at 10:51:54AM +0800, Kunwu Chan wrote:
> On 2024/8/27 21:37, Andy Shevchenko wrote:
> > On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
> > > On 2024/8/26 18:40, Andy Shevchenko wrote:
> > > > On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:

...

> > > > Make it patch series:
> > > > 1) patch that introduces exported function called dev_is_amba() (1 patch)
> Done.
> > > > 2) convert user-by-user (N patches)
> 
> I've no idea about how to modify, such as in iommu.c:

Oh, crap. Yes, this need more thinking.
Anyway, Russell is okay with your initial patch, the rest can be done
separately. For now probably we can leave it exported for this only case.


-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
Thanks for the reply.
On 2024/8/28 21:17, Andy Shevchenko wrote:
> On Wed, Aug 28, 2024 at 10:51:54AM +0800, Kunwu Chan wrote:
>> On 2024/8/27 21:37, Andy Shevchenko wrote:
>>> On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
>>>> On 2024/8/26 18:40, Andy Shevchenko wrote:
>>>>> On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
> ...
>
>>>>> Make it patch series:
>>>>> 1) patch that introduces exported function called dev_is_amba() (1 patch)
>> Done.
>>>>> 2) convert user-by-user (N patches)
>> I've no idea about how to modify, such as in iommu.c:
> Oh, crap. Yes, this need more thinking.
> Anyway, Russell is okay with your initial patch, the rest can be done
> separately. For now probably we can leave it exported for this only case.
>
Anyway, thanks for the suggestion, i'll   introduce the dev_is_amba 
function

and  add the Suggested tag for you.

If you have a better idea and need me to do it, you can always contact me.

-- 
Thanks,
   Kunwu.Chan

Re: [PATCH] amba: make amba_bustype constant
Posted by Russell King (Oracle) 1 year, 5 months ago
On Thu, Aug 29, 2024 at 09:31:29AM +0800, Kunwu Chan wrote:
> Thanks for the reply.
> On 2024/8/28 21:17, Andy Shevchenko wrote:
> > On Wed, Aug 28, 2024 at 10:51:54AM +0800, Kunwu Chan wrote:
> > > On 2024/8/27 21:37, Andy Shevchenko wrote:
> > > > On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
> > > > > On 2024/8/26 18:40, Andy Shevchenko wrote:
> > > > > > On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
> > ...
> > 
> > > > > > Make it patch series:
> > > > > > 1) patch that introduces exported function called dev_is_amba() (1 patch)
> > > Done.
> > > > > > 2) convert user-by-user (N patches)
> > > I've no idea about how to modify, such as in iommu.c:
> > Oh, crap. Yes, this need more thinking.
> > Anyway, Russell is okay with your initial patch, the rest can be done
> > separately. For now probably we can leave it exported for this only case.
> > 
> Anyway, thanks for the suggestion, i'll   introduce the dev_is_amba function
> 
> and  add the Suggested tag for you.
> 
> If you have a better idea and need me to do it, you can always contact me.

General policy is not to add stuff that doesn't have any users. From
what I can see from briefly reading this discussion, and looking at
the patches submitted to me, the dev_is_amba() patch adds a helper,
but as yet there are no users - and not even any patches on a mailing
list to make use of this helper. Therefore, I won't be applying that
patch.

Good idea, but it needs users...

Please note that I likely won't be reading further discussion (see
my signature below, and I'm having the same op on the other eye -
which is the only eye suitable for screen work at the moment -
this Friday.)

-- 
*** please note that I probably will only be occasionally responsive
*** for an unknown period of time due to recent eye surgery making
*** reading quite difficult.

RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
Thanks for the reply.
On 2024/9/4 21:58, Russell King (Oracle) wrote:
> On Thu, Aug 29, 2024 at 09:31:29AM +0800, Kunwu Chan wrote:
>> Thanks for the reply.
>> On 2024/8/28 21:17, Andy Shevchenko wrote:
>>> On Wed, Aug 28, 2024 at 10:51:54AM +0800, Kunwu Chan wrote:
>>>> On 2024/8/27 21:37, Andy Shevchenko wrote:
>>>>> On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
>>>>>> On 2024/8/26 18:40, Andy Shevchenko wrote:
>>>>>>> On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:
>>> ...
>>>
>>>>>>> Make it patch series:
>>>>>>> 1) patch that introduces exported function called dev_is_amba() (1 patch)
>>>> Done.
>>>>>>> 2) convert user-by-user (N patches)
>>>> I've no idea about how to modify, such as in iommu.c:
>>> Oh, crap. Yes, this need more thinking.
>>> Anyway, Russell is okay with your initial patch, the rest can be done
>>> separately. For now probably we can leave it exported for this only case.
>>>
>> Anyway, thanks for the suggestion, i'll   introduce the dev_is_amba function
>>
>> and  add the Suggested tag for you.
>>
>> If you have a better idea and need me to do it, you can always contact me.
> General policy is not to add stuff that doesn't have any users. From
> what I can see from briefly reading this discussion, and looking at
> the patches submitted to me, the dev_is_amba() patch adds a helper,
> but as yet there are no users - and not even any patches on a mailing
> list to make use of this helper. Therefore, I won't be applying that
> patch.

Actually, here is a user in [1], i'am ready to use it  in [2].

  #ifdef CONFIG_ARM_AMBA
  	else if (dev->bus == &amba_bustype)

[1] 
https://elixir.bootlin.com/linux/v6.10.8/source/drivers/of/platform.c#L631

[2] https://lore.kernel.org/all/20240828150826.GA3803566-robh@kernel.org/

> Good idea, but it needs users...
>
> Please note that I likely won't be reading further discussion (see
> my signature below, and I'm having the same op on the other eye -
> which is the only eye suitable for screen work at the moment -
> this Friday.)

Sure, i've send it to the armlinux.org.uk as:

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9415/1

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9416/1


Good health.

-- 
Thanks,
   Kunwu.Chan

Re: [PATCH] amba: make amba_bustype constant
Posted by Andy Shevchenko 1 year, 5 months ago
On Wed, Sep 04, 2024 at 02:58:36PM +0100, Russell King (Oracle) wrote:
> On Thu, Aug 29, 2024 at 09:31:29AM +0800, Kunwu Chan wrote:
> > Thanks for the reply.
> > On 2024/8/28 21:17, Andy Shevchenko wrote:
> > > On Wed, Aug 28, 2024 at 10:51:54AM +0800, Kunwu Chan wrote:
> > > > On 2024/8/27 21:37, Andy Shevchenko wrote:
> > > > > On Tue, Aug 27, 2024 at 03:45:31PM +0800, Kunwu Chan wrote:
> > > > > > On 2024/8/26 18:40, Andy Shevchenko wrote:
> > > > > > > On Mon, Aug 26, 2024 at 06:08:11PM +0800, Kunwu Chan wrote:

...

> > > > > > > Make it patch series:
> > > > > > > 1) patch that introduces exported function called dev_is_amba() (1 patch)
> > > > Done.
> > > > > > > 2) convert user-by-user (N patches)
> > > > I've no idea about how to modify, such as in iommu.c:
> > > Oh, crap. Yes, this need more thinking.
> > > Anyway, Russell is okay with your initial patch, the rest can be done
> > > separately. For now probably we can leave it exported for this only case.
> > > 
> > Anyway, thanks for the suggestion, i'll   introduce the dev_is_amba function
> > 
> > and  add the Suggested tag for you.
> > 
> > If you have a better idea and need me to do it, you can always contact me.
> 
> General policy is not to add stuff that doesn't have any users. From
> what I can see from briefly reading this discussion, and looking at
> the patches submitted to me, the dev_is_amba() patch adds a helper,
> but as yet there are no users - and not even any patches on a mailing
> list to make use of this helper. Therefore, I won't be applying that
> patch.
> 
> Good idea, but it needs users...

I agree, we need at least a couple of user to convert.

> Please note that I likely won't be reading further discussion (see
> my signature below, and I'm having the same op on the other eye -
> which is the only eye suitable for screen work at the moment -
> this Friday.)

Oh, wish you a successful op and fast recovery!

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] amba: make amba_bustype constant
Posted by Kunwu Chan 1 year, 5 months ago
Thanks for the reply.
On 2024/8/23 21:48, Andy Shevchenko wrote:
> On Fri, Aug 23, 2024 at 02:42:03PM +0800, Kunwu Chan wrote:
>> From: Kunwu Chan <chentao@kylinos.cn>
>>
>> Since commit d492cc2573a0 ("driver core: device.h: make struct
>> bus_type a const *"), the driver core can properly handle constant
>> struct bus_type, move the amba_bustype variable to be a constant
>> structure as well, placing it into read-only memory which can not be
>> modified at runtime.
> ...
>
>> -extern struct bus_type amba_bustype;
>> +extern const struct bus_type amba_bustype;
> Can we actually hide this from the outside, i.e. make it static in the C file,
> and introduce the dev_is_amba() helper instead?
Sure, i've find the patch  series 
(https://lore.kernel.org/all/20240528102708.1451343-2-andy.shevchenko@gmail.com/)
> P.S. You may look at the PNP bus case (some of the latest patches there).
>
I'll change it as PNP bus in v2.

-- 
Thanks,
   Kunwu.Chan