From: Kunwu Chan <kunwu.chan@linux.dev>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux@armlinux.org.uk, krzk@kernel.org, andi.shyti@kernel.org,
robh@kernel.org, gregkh@linuxfoundation.org,
suzuki.poulose@arm.com, rmk+kernel@armlinux.org.uk,
linux-kernel@vger.kernel.org, Kunwu Chan <chentao@kylinos.cn>
Subject: Re: [PATCH] amba: make amba_bustype constant
Date: Wed, 28 Aug 2024 10:51:54 +0800 [thread overview]
Message-ID: <6774cd23-47f9-4d15-8954-a9f749998fe2@linux.dev> (raw)
In-Reply-To: <Zs3Wt5xkFOiuH-iP@smile.fi.intel.com>
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
next prev parent reply other threads:[~2024-08-28 2:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 6:42 [PATCH] amba: make amba_bustype constant Kunwu Chan
2024-08-23 13:48 ` Andy Shevchenko
2024-08-26 8:20 ` Kunwu Chan
2024-08-26 10:08 ` Kunwu Chan
2024-08-26 10:40 ` Andy Shevchenko
2024-08-27 7:45 ` Kunwu Chan
2024-08-27 13:37 ` Andy Shevchenko
2024-08-28 2:51 ` Kunwu Chan [this message]
2024-08-28 13:17 ` Andy Shevchenko
2024-08-29 1:31 ` Kunwu Chan
2024-09-04 13:58 ` Russell King (Oracle)
2024-09-04 14:07 ` Andy Shevchenko
2024-09-05 8:51 ` Kunwu Chan
2024-08-27 13:46 ` Russell King (Oracle)
2024-08-28 3:00 ` Kunwu Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6774cd23-47f9-4d15-8954-a9f749998fe2@linux.dev \
--to=kunwu.chan@linux.dev \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=chentao@kylinos.cn \
--cc=gregkh@linuxfoundation.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox