Re: [PATCH V4 1/8] drivers/acpi: Add support for Wifi band RF mitigations

Andrew Lunn
2023-06-21T17:26:35Z

> I think what you're asking for is another layer of indirection
> like CONFIG_WBRF in addition to CONFIG_ACPI_WBRF.
>
> Producers would call functions like wbrf_supported_producer()
> where the source file is not guarded behind CONFIG_ACPI_WBRF,
> but instead by CONFIG_WBRF and locally use CONFIG_ACPI_WBRF within
> it.  So a producer could look like this:
>
> bool wbrf_supported_producer(struct device *dev)
> {
> #ifdef CONFIG_ACPI_WBRF
>     struct acpi_device *adev = ACPI_COMPANION(dev);
>
>     if (adev)
>         return check_acpi_wbrf(adev->handle,
>                        WBRF_REVISION,
>                        1ULL << WBRF_RECORD);
> #endif
>     return -ENODEV;
>
> }
> EXPORT_SYMBOL_GPL(wbrf_supported_producer);
>
> And then adding/removing could look something like this
>
> int wbrf_add_exclusion(struct device *dev,
>                struct wbrf_ranges_in *in)
> {
> #ifdef CONFIG_ACPI_WBRF
>     struct acpi_device *adev = ACPI_COMPANION(dev);
>
>     if (adev)
>         return wbrf_record(adev, WBRF_RECORD_ADD, in);
> #endif
>     return -ENODEV;
> }
> EXPORT_SYMBOL_GPL(wbrf_add_exclusion);
>
> int wbrf_remove_exclusion(struct device *dev,
>                struct wbrf_ranges_in *in)
> {
> #ifdef CONFIG_ACPI_WBRF
>     struct acpi_device *adev = ACPI_COMPANION(dev);
>
>     if (adev)
>         return wbrf_record(adev, WBRF_RECORD_REMOVE, in);
> #endif
>     return -ENODEV;
> }
> EXPORT_SYMBOL_GPL(wbrf_remove_exclusion);

Yes, this looks a lot better.

But what about notifications?

Andrew