mbox series

[00/25] ACPI: First step to decouple ACPICA debug functionality from ACPI driver

Message ID 1600328345-27627-1-git-send-email-guohanjun@huawei.com (mailing list archive)
Headers show
Series ACPI: First step to decouple ACPICA debug functionality from ACPI driver | expand

Message

Hanjun Guo Sept. 17, 2020, 7:38 a.m. UTC
For now, ACPI driver debug functionality is mixed of pr_* functions and
ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug
functions are not friendly for users and also make ACPICA core deeply
coupled with ACPI drivers.

With the evolution of the ACPI driver code, lots of the ACPICA debug
functions used in ACPI drivers were removed away, this makes the ACPICA
debug in ACPI driver to be fragile, for example, some of the COMPONENT
such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not
used anymore, they leaved as dead code.

From another aspert, removing the ACPICA debug functions didn't raise
concerns in the past, so I believe the ACPICA debug in ACPI driver can be
removed and replace with equivalent pr_* debug functions, then decouple
ACPICA debug functionality from ACPI driver.

In order to decouple ACPICA debug functionality from ACPI driver, I do it
in two steps:
 - Remove the dead ACPICA functionality code, and remove the not used
   COMPONENT;
 - Remove all the ACPICA debug code from ACPI drivers.

This patch set is the first step to decouple ACPICA debug functionality
from ACPI driver, just remove the dead ACPICA functionality code and
some cleanups for ACPI drivers, should no functional change if you don't
apply the last two patches.

Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups;
Patch 24/25 ~ patch 25/25 are the actual ABI change.

If the ABI change is making sense, I will go further to remove the
ACPICA debug functionality from ACPI driver, just keep it inside
the ACPICA core.

Hanjun Guo (25):
  ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()
  ACPI: configfs: Decouple with ACPICA
  ACPI: configfs: Add the missing config_item_put()
  ACPI: debug: Remove the not used function
  ACPI: LPSS: Remove the ACPI_MODULE_NAME()
  ACPI: memhotplug: Remove the leftover ACPICA debug functionality
  ACPI: memhotplug: Remove the state for memory device
  ACPI: platform: Remove the leftover ACPICA debug functinality
  ACPI: container: Remove the leftover ACPICA debug functionality
  ACPI: custom_method: Remove the ACPICA debug code
  ACPI: debugfs: Remove the ACPICA debug code
  ACPI: dock: Remove the ACPICA debug code
  ACPI: event: Remove the ACPICA debug code
  ACPI: PCI: Remove the unused ACPICA debug code
  ACPI: proc: Remove the unused ACPICA debug code
  ACPI: processor: Remove the dead ACPICA debug code
  ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro
  ACPI: SBS: Simplify the driver init code
  ACPI: SBS: Simplify the code using module_acpi_driver()
  ACPI: tiny-power-button: Remove the dead ACPICA debug code
  ACPI: tiny-power-button: Simplify the code using module_acpi_driver()
  ACPI: video: Remove the dead ACPICA debug code
  ACPI: wakeup: Remove the dead ACPICA debug code
  ACPI: sysfs: Remove the dead debug interfaces
  ACPI: debug: Update the ACPI debug document

 Documentation/firmware-guide/acpi/debug.rst |  4 ----
 drivers/acpi/acpi_cmos_rtc.c                |  2 --
 drivers/acpi/acpi_configfs.c                |  6 ++----
 drivers/acpi/acpi_dbg.c                     |  7 -------
 drivers/acpi/acpi_lpss.c                    |  2 --
 drivers/acpi/acpi_memhotplug.c              | 17 -----------------
 drivers/acpi/acpi_platform.c                |  2 --
 drivers/acpi/container.c                    |  3 ---
 drivers/acpi/custom_method.c                |  2 --
 drivers/acpi/debugfs.c                      |  3 ---
 drivers/acpi/dock.c                         |  2 --
 drivers/acpi/event.c                        |  3 ---
 drivers/acpi/pci_root.c                     |  2 --
 drivers/acpi/pci_slot.c                     |  3 ---
 drivers/acpi/proc.c                         |  4 ----
 drivers/acpi/processor_core.c               |  3 ---
 drivers/acpi/processor_idle.c               |  1 -
 drivers/acpi/processor_perflib.c            |  1 -
 drivers/acpi/processor_thermal.c            |  4 ----
 drivers/acpi/processor_throttling.c         |  1 -
 drivers/acpi/sbs.c                          | 24 +-----------------------
 drivers/acpi/sysfs.c                        | 18 +++++++-----------
 drivers/acpi/tiny-power-button.c            |  5 +----
 drivers/acpi/video_detect.c                 |  3 ---
 drivers/acpi/wakeup.c                       |  2 --
 include/acpi/acpi_drivers.h                 |  8 ++------
 26 files changed, 13 insertions(+), 119 deletions(-)

Comments

Rafael J. Wysocki Sept. 17, 2020, 3:08 p.m. UTC | #1
Hi Hanjun,

On Thu, Sep 17, 2020 at 10:34 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> For now, ACPI driver debug functionality is mixed of pr_* functions and
> ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug
> functions are not friendly for users and also make ACPICA core deeply
> coupled with ACPI drivers.
>
> With the evolution of the ACPI driver code, lots of the ACPICA debug
> functions used in ACPI drivers were removed away, this makes the ACPICA
> debug in ACPI driver to be fragile, for example, some of the COMPONENT
> such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not
> used anymore, they leaved as dead code.
>
> From another aspert, removing the ACPICA debug functions didn't raise
> concerns in the past, so I believe the ACPICA debug in ACPI driver can be
> removed and replace with equivalent pr_* debug functions, then decouple
> ACPICA debug functionality from ACPI driver.

This is a worthy goal, but the patch series appears to be a mixed bag
of changes some of which are not directly related to this goal.

> In order to decouple ACPICA debug functionality from ACPI driver, I do it
> in two steps:
>  - Remove the dead ACPICA functionality code, and remove the not used
>    COMPONENT;
>  - Remove all the ACPICA debug code from ACPI drivers.
>
> This patch set is the first step to decouple ACPICA debug functionality
> from ACPI driver, just remove the dead ACPICA functionality code and
> some cleanups for ACPI drivers, should no functional change if you don't
> apply the last two patches.
>
> Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups;
> Patch 24/25 ~ patch 25/25 are the actual ABI change.
>
> If the ABI change is making sense, I will go further to remove the
> ACPICA debug functionality from ACPI driver, just keep it inside
> the ACPICA core.
>
> Hanjun Guo (25):
>   ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()

This, for example, should be a separate cleanup patch.

>   ACPI: configfs: Decouple with ACPICA
>   ACPI: configfs: Add the missing config_item_put()

This appears to be a fix that should go in separate from the rest of the series.

>   ACPI: debug: Remove the not used function

Another separate cleanup.

>   ACPI: LPSS: Remove the ACPI_MODULE_NAME()

Yet another one.

So can you please split up the patch set into several smaller and more
manageable ones?

Thanks!
Hanjun Guo Sept. 18, 2020, 1:55 a.m. UTC | #2
Hi Rafael,

On 2020/9/17 23:08, Rafael J. Wysocki wrote:
> Hi Hanjun,
> 
> On Thu, Sep 17, 2020 at 10:34 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>>
>> For now, ACPI driver debug functionality is mixed of pr_* functions and
>> ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug
>> functions are not friendly for users and also make ACPICA core deeply
>> coupled with ACPI drivers.
>>
>> With the evolution of the ACPI driver code, lots of the ACPICA debug
>> functions used in ACPI drivers were removed away, this makes the ACPICA
>> debug in ACPI driver to be fragile, for example, some of the COMPONENT
>> such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not
>> used anymore, they leaved as dead code.
>>
>>  From another aspert, removing the ACPICA debug functions didn't raise
>> concerns in the past, so I believe the ACPICA debug in ACPI driver can be
>> removed and replace with equivalent pr_* debug functions, then decouple
>> ACPICA debug functionality from ACPI driver.
> 
> This is a worthy goal, but the patch series appears to be a mixed bag
> of changes some of which are not directly related to this goal.

Sorry for that, I sent this patch set in a hurry, I will update
as you suggested.

> 
>> In order to decouple ACPICA debug functionality from ACPI driver, I do it
>> in two steps:
>>   - Remove the dead ACPICA functionality code, and remove the not used
>>     COMPONENT;
>>   - Remove all the ACPICA debug code from ACPI drivers.
>>
>> This patch set is the first step to decouple ACPICA debug functionality
>> from ACPI driver, just remove the dead ACPICA functionality code and
>> some cleanups for ACPI drivers, should no functional change if you don't
>> apply the last two patches.
>>
>> Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups;
>> Patch 24/25 ~ patch 25/25 are the actual ABI change.
>>
>> If the ABI change is making sense, I will go further to remove the
>> ACPICA debug functionality from ACPI driver, just keep it inside
>> the ACPICA core.
>>
>> Hanjun Guo (25):
>>    ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()
> 
> This, for example, should be a separate cleanup patch.

ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA
debug functionality, so I will put them in the decouple
patch set.

> 
>>    ACPI: configfs: Decouple with ACPICA
>>    ACPI: configfs: Add the missing config_item_put()
> 
> This appears to be a fix that should go in separate from the rest of the series.

Will send a fix first!

> 
>>    ACPI: debug: Remove the not used function
> 
> Another separate cleanup.
> 
>>    ACPI: LPSS: Remove the ACPI_MODULE_NAME()
> 
> Yet another one.
> 
> So can you please split up the patch set into several smaller and more
> manageable ones?

Will do, thanks for your comments!

Thanks
Hanjun
Rafael J. Wysocki Sept. 18, 2020, 1:34 p.m. UTC | #3
On Fri, Sep 18, 2020 at 3:55 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>
> Hi Rafael,
>
> On 2020/9/17 23:08, Rafael J. Wysocki wrote:
> > Hi Hanjun,
> >
> > On Thu, Sep 17, 2020 at 10:34 AM Hanjun Guo <guohanjun@huawei.com> wrote:
> >>
> >> For now, ACPI driver debug functionality is mixed of pr_* functions and
> >> ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug
> >> functions are not friendly for users and also make ACPICA core deeply
> >> coupled with ACPI drivers.
> >>
> >> With the evolution of the ACPI driver code, lots of the ACPICA debug
> >> functions used in ACPI drivers were removed away, this makes the ACPICA
> >> debug in ACPI driver to be fragile, for example, some of the COMPONENT
> >> such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not
> >> used anymore, they leaved as dead code.
> >>
> >>  From another aspert, removing the ACPICA debug functions didn't raise
> >> concerns in the past, so I believe the ACPICA debug in ACPI driver can be
> >> removed and replace with equivalent pr_* debug functions, then decouple
> >> ACPICA debug functionality from ACPI driver.
> >
> > This is a worthy goal, but the patch series appears to be a mixed bag
> > of changes some of which are not directly related to this goal.
>
> Sorry for that, I sent this patch set in a hurry, I will update
> as you suggested.
>
> >
> >> In order to decouple ACPICA debug functionality from ACPI driver, I do it
> >> in two steps:
> >>   - Remove the dead ACPICA functionality code, and remove the not used
> >>     COMPONENT;
> >>   - Remove all the ACPICA debug code from ACPI drivers.
> >>
> >> This patch set is the first step to decouple ACPICA debug functionality
> >> from ACPI driver, just remove the dead ACPICA functionality code and
> >> some cleanups for ACPI drivers, should no functional change if you don't
> >> apply the last two patches.
> >>
> >> Patch 1/25 ~ patch 23/25 are removing the dead code and cleanups;
> >> Patch 24/25 ~ patch 25/25 are the actual ABI change.
> >>
> >> If the ABI change is making sense, I will go further to remove the
> >> ACPICA debug functionality from ACPI driver, just keep it inside
> >> the ACPICA core.
> >>
> >> Hanjun Guo (25):
> >>    ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()
> >
> > This, for example, should be a separate cleanup patch.
>
> ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA
> debug functionality, so I will put them in the decouple
> patch set.

So if the ACPICA debug functionality is not used in the given C file,
you can drop these macros from there right away without any side
effects.

Why don't you do that in a separate series of patches then?

Thanks!
Hanjun Guo Sept. 19, 2020, 7:22 a.m. UTC | #4
Hi Rafael,

On 2020/9/18 21:34, Rafael J. Wysocki wrote:
> On Fri, Sep 18, 2020 at 3:55 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>>
>> Hi Rafael,
>>
>> On 2020/9/17 23:08, Rafael J. Wysocki wrote:
>>> Hi Hanjun,
>>>
>>> On Thu, Sep 17, 2020 at 10:34 AM Hanjun Guo <guohanjun@huawei.com> wrote:
>>>>
>>>> For now, ACPI driver debug functionality is mixed of pr_* functions and
>>>> ACPI_DEBUG_PRINT() which is provided ACPICA core directly, ACPICA debug
>>>> functions are not friendly for users and also make ACPICA core deeply
>>>> coupled with ACPI drivers.
>>>>
>>>> With the evolution of the ACPI driver code, lots of the ACPICA debug
>>>> functions used in ACPI drivers were removed away, this makes the ACPICA
>>>> debug in ACPI driver to be fragile, for example, some of the COMPONENT
>>>> such as ACPI_CONTAINER_COMPONENT and ACPI_MEMORY_DEVICE_COMPONENT are not
>>>> used anymore, they leaved as dead code.
>>>>
>>>>   From another aspert, removing the ACPICA debug functions didn't raise
>>>> concerns in the past, so I believe the ACPICA debug in ACPI driver can be
>>>> removed and replace with equivalent pr_* debug functions, then decouple
>>>> ACPICA debug functionality from ACPI driver.
>>>
>>> This is a worthy goal, but the patch series appears to be a mixed bag
>>> of changes some of which are not directly related to this goal.
>>
>> Sorry for that, I sent this patch set in a hurry, I will update
>> as you suggested.
>>>>
>>>> Hanjun Guo (25):
>>>>     ACPI: cmos_rtc: Remove the ACPI_MODULE_NAME()
>>>
>>> This, for example, should be a separate cleanup patch.
>>
>> ACPI_MODULE_NAME() and _COMPONENT are both used for ACPICA
>> debug functionality, so I will put them in the decouple
>> patch set.
> 
> So if the ACPICA debug functionality is not used in the given C file,
> you can drop these macros from there right away without any side
> effects.
> 
> Why don't you do that in a separate series of patches then?

Good point, so I will split this patch set into four parts:

- The bugfix patch goes in separate from the rest of the series,
   already sent out.

- Cleanup patches which is not related to ACPICA debug,
   - ACPI: debug: Remove the not used function
   - ACPI: memhotplug: Remove the state for memory device
   - ACPI: processor: Remove the duplicated ACPI_PROCESSOR_CLASS macro

   - ACPI: SBS: Simplify the driver init code
   - ACPI: SBS: Simplify the code using module_acpi_driver()
   - ACPI: tiny-power-button: Simplify the code using module_acpi_driver()

- A patch set removing all the leftover ACPICA debug functionality
   which is not used in the C file, no functional change.

- A patch set for actual ABI change (RFC).

Do it make sense to you?

Thanks
Hanjun