Re: [PATCH next v9 1/4] i2c: hisi: Add initial device tree support
From: chenweilong
Date: Sun Oct 30 2022 - 21:58:17 EST
On 2022/10/31 6:01, Andy Shevchenko wrote:
> On Sat, Oct 29, 2022 at 07:59:36PM +0800, Weilong Chen wrote:
>> The HiSilicon I2C controller can be used on embedded platform, which
>> boot from devicetree.
> ...
>
>> +#include <linux/acpi.h>
>> +#include <linux/of.h>
> Why?
>
> ...
>
>> +#ifdef CONFIG_ACPI
> Why?
>
> ...
>
>> +#ifdef CONFIG_OF
> Why?
>
> ...
>
>> - .acpi_match_table = hisi_i2c_acpi_ids,
>> + .acpi_match_table = ACPI_PTR(hisi_i2c_acpi_ids),
> Why?
>
> ...
>
>> + .of_match_table = of_match_ptr(hisi_i2c_dts_ids),
> Why of_match_ptr()?
There's a lot of drivers use of_match_ptr/ACPI_PTR to protect the of_device_id and
have explicit headers file references to linux/acpi.h or linux/of.h, such as
drivers/media/platform/intel/pxa_camera.c,
bluetooth/hci_intel.c,
platform/x86/intel/chtwc_int33fe.c,
platform/x86/intel/pmc/core.c and so on.
The acpi.h and of.h have a nice function or macro definition if CONFIG_OF/ACPI is not satisfy,
for example:
#define ACPI_PTR(_ptr) (_ptr) vs #define ACPI_PTR(_ptr) (NULL)
and also a lot of 'static inline' function there.
Seems a good idea to remove all of them, the codes your noted may look a bit verbose there ,
But I think it is valuable for a driver and device ,telling users it support acpi boot or is it just embedded.
Thanks for review.
Best Regards.
>