[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b4987e3-af8a-413f-bbbe-d493d6c371f6@linux.dev>
Date: Tue, 27 Aug 2024 15:45:31 +0800
From: Kunwu Chan <kunwu.chan@...ux.dev>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux@...linux.org.uk, krzk@...nel.org, andi.shyti@...nel.org,
robh@...nel.org, gregkh@...uxfoundation.org, suzuki.poulose@....com,
rmk+kernel@...linux.org.uk, linux-kernel@...r.kernel.org,
Kunwu Chan <chentao@...inos.cn>
Subject: Re: [PATCH] amba: make amba_bustype constant
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
Powered by blists - more mailing lists