[PATCH v2] goldfish: Fix unused const variable 'goldfish_pipe_acpi_match'

Zeng Heng posted 1 patch 1 month ago
drivers/platform/goldfish/goldfish_pipe.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH v2] goldfish: Fix unused const variable 'goldfish_pipe_acpi_match'
Posted by Zeng Heng 1 month ago
Fix the following compilation warning:

drivers/platform/goldfish/goldfish_pipe.c:925:36: warning:
‘goldfish_pipe_acpi_match’ defined but not used
[-Wunused-const-variable=]
  925 | static const struct acpi_device_id goldfish_pipe_acpi_match[] = {

The complexity of config guards needed for ACPI_PTR() is not worthwhile
for the small amount of saved data. So remove the use of ACPI_PTR instead
and drop now unneeded linux/acpi.h include.

Fixes: d62f324b0ac8 ("goldfish: Enable ACPI-based enumeration for android pipe")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 drivers/platform/goldfish/goldfish_pipe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c
index c2aab0cfab33..ca78e5833136 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -61,7 +61,6 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/mm.h>
-#include <linux/acpi.h>
 #include <linux/bug.h>
 #include "goldfish_pipe_qemu.h"
 
@@ -940,7 +939,7 @@ static struct platform_driver goldfish_pipe_driver = {
 	.driver = {
 		.name = "goldfish_pipe",
 		.of_match_table = goldfish_pipe_of_match,
-		.acpi_match_table = ACPI_PTR(goldfish_pipe_acpi_match),
+		.acpi_match_table = goldfish_pipe_acpi_match,
 	}
 };
 
-- 
2.25.1

Re: [PATCH v2] goldfish: Fix unused const variable 'goldfish_pipe_acpi_match'
Posted by Andy Shevchenko 2 weeks, 4 days ago
On Sat, Oct 26, 2024 at 03:01:50PM +0800, Zeng Heng wrote:
> Fix the following compilation warning:
> 
> drivers/platform/goldfish/goldfish_pipe.c:925:36: warning:
> ‘goldfish_pipe_acpi_match’ defined but not used
> [-Wunused-const-variable=]
>   925 | static const struct acpi_device_id goldfish_pipe_acpi_match[] = {
> 
> The complexity of config guards needed for ACPI_PTR() is not worthwhile
> for the small amount of saved data. So remove the use of ACPI_PTR instead
> and drop now unneeded linux/acpi.h include.

...

>  #include <linux/io.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/mm.h>
> -#include <linux/acpi.h>

Because header inclusions are unsorted, it's unclear if there is
mod_devicetable.h included. If not, you should replace acpi.h with
mod_devicetable.h.

>  #include <linux/bug.h>
>  #include "goldfish_pipe_qemu.h"

Otherwise LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko


Re: [PATCH v2] goldfish: Fix unused const variable 'goldfish_pipe_acpi_match'
Posted by Zeng Heng 2 weeks, 4 days ago
On 2024/11/6 23:57, Andy Shevchenko wrote:
> On Sat, Oct 26, 2024 at 03:01:50PM +0800, Zeng Heng wrote:
>> Fix the following compilation warning:
>>
>> drivers/platform/goldfish/goldfish_pipe.c:925:36: warning:
>> ‘goldfish_pipe_acpi_match’ defined but not used
>> [-Wunused-const-variable=]
>>    925 | static const struct acpi_device_id goldfish_pipe_acpi_match[] = {
>>
>> The complexity of config guards needed for ACPI_PTR() is not worthwhile
>> for the small amount of saved data. So remove the use of ACPI_PTR instead
>> and drop now unneeded linux/acpi.h include.
> ...
>
>>   #include <linux/io.h>
>>   #include <linux/dma-mapping.h>
>>   #include <linux/mm.h>
>> -#include <linux/acpi.h>
> Because header inclusions are unsorted, it's unclear if there is
> mod_devicetable.h included. If not, you should replace acpi.h with
> mod_devicetable.h.

Yes, I checked mod_devicetable.h had been already included in 
goldfish_pipe_qemu.c before.

After the patch is applied, the header files included in the source file 
are as follows:

~~~

#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/miscdevice.h>
#include <linux/platform_device.h>
#include <linux/poll.h>
#include <linux/sched.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/dma-mapping.h>
#include <linux/mm.h>
#include <linux/bug.h>
#include "goldfish_pipe_qemu.h"

~~~


Best regards,

Zeng Heng