ACPI: platform: Get rid of redundant 'else'
PATCH 1/4 ACPI: platform: Get rid of redundant 'else'
In the snippets like the following
if (...) return / goto / break / continue ...; else ...
the 'else' is redundant. Get rid of it.
--- drivers/acpi/acpi_platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/acpi/acpi_platform.c +2 -2
@@ -114,9 +114,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,INIT_LIST_HEAD (&resource_list); count =acpi_dev_get_resources (adev, &resource_list,NULL ,NULL ); -if (count <0 ) { +if (count <0 )return NULL ; - }else if (count >0 ) { +if (count >0 ) { resources =kcalloc (count,sizeof (struct resource ),GFP_KERNEL );if (!resources) {
Signature · 1 line
2.35.1
PATCH 2/4 ACPI: platform: Remove redundant print on ENOMEM
We rely on somebody else to print enough information on failures. So remove the log in acpi_create_platform_device() when return -ENOMEM.
--- drivers/acpi/acpi_platform.c | 1 - 1 file changed, 1 deletion(-)
drivers/acpi/acpi_platform.c +0 -1
@@ -120,7 +120,6 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, resources =kcalloc (count,sizeof (struct resource ),GFP_KERNEL );if (!resources) { -dev_err (&adev->dev,"No memory for resources\n" );acpi_dev_free_resource_list (&resource_list);return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.35.1
PATCH 3/4 ACPI: platform: Use sizeof(*pointer) instead of sizeof(type)
In reply to Andy ShevchenkoIt is preferred to use sizeof(*pointer) instead of sizeof(type). The type of the variable can change and one needs not change the former (unlike the latter). No functional change intended.
--- drivers/acpi/acpi_platform.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/acpi/acpi_platform.c +1 -2
@@ -117,8 +117,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,if (count <0 )return NULL ;if (count >0 ) { - resources =kcalloc (count,sizeof (struct resource ), -GFP_KERNEL ); + resources =kcalloc (count,sizeof (*resources),GFP_KERNEL );if (!resources) {acpi_dev_free_resource_list (&resource_list);return ERR_PTR (-ENOMEM );
Signature · 1 line
2.35.1
PATCH 4/4 ACPI: platform: Keep list of ACPI IDs sorted
In reply to Andy ShevchenkoFor better maintenance keep list of the ACPI IDs sorted. While at it, replace terminator with more standard '{ }'.
--- drivers/acpi/acpi_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/acpi/acpi_platform.c +3 -3
@@ -20,13 +20,13 @@#include "internal.h" static const struct acpi_device_id forbidden_id_list[] = { + {"ACPI0009" ,0 },/* IOxAPIC */ + {"ACPI000A" ,0 },/* IOAPIC */ {"PNP0000" ,0 },/* PIC */ {"PNP0100" ,0 },/* Timer */ {"PNP0200" ,0 },/* AT DMA Controller */ - {"ACPI0009" ,0 },/* IOxAPIC */ - {"ACPI000A" ,0 },/* IOAPIC */ {"SMB0001" ,0 },/* ACPI SMBUS virtual device */ - {"" ,0 }, + { } };static struct platform_device *acpi_platform_device_find_by_companion (struct acpi_device *adev)
Signature · 1 line
2.35.1
Rafael J. Wysocki
maintainerRe: [PATCH v1 4/4] ACPI: platform: Keep list of ACPI IDs sorted
Quoted 5 lines · Andy Shevchenko
For better maintenance keep list of the ACPI IDs sorted. While at it, replace terminator with more standard '{ }'.
Signed-off-by Andy Shevchenko <[email protected]>
Subject: ACPI: platform: Sort forbidden_id_list[] in ascending order
Changelog:
"For easier maintenance, sort the forbidden_id_list[] table rows in ascending order with respect to the device ID field.
While at it, use an empty row as the list terminator, which is more usual in the kernel."
Pretty please.
Quoted 26 lines
--- drivers/acpi/acpi_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/acpi/acpi_platform.c +3
-4@@ -20,13 +20,13 @@#include "internal.h" static const struct acpi_device_id forbidden_id_list[] = { + {"ACPI0009" ,0 },/* IOxAPIC */ + {"ACPI000A" ,0 },/* IOAPIC */ {"PNP0000" ,0 },/* PIC */ {"PNP0100" ,0 },/* Timer */ {"PNP0200" ,0 },/* AT DMA Controller */ - {"ACPI0009" ,0 },/* IOxAPIC */ - {"ACPI000A" ,0 },/* IOAPIC */ {"SMB0001" ,0 },/* ACPI SMBUS virtual device */ - {"" ,0 }, + { } };static struct platform_device *acpi_platform_device_find_by_companion (struct acpi_device *adev) --
Re: [PATCH v1 4/4] ACPI: platform: Keep list of ACPI IDs sorted
Quoted 12 lines · Rafael J. Wysocki
Quoted 5 lines · Andy Shevchenko
For better maintenance keep list of the ACPI IDs sorted. While at it, replace terminator with more standard '{ }'.
Signed-off-by Andy Shevchenko <[email protected]>Subject: ACPI: platform: Sort forbidden_id_list[] in ascending order
Changelog:
Quoted 7 lines
"For easier maintenance, sort the forbidden_id_list[] table rows in ascending order with respect to the device ID field.
While at it, use an empty row as the list terminator, which is more usual in the kernel."
Pretty please.
Sure, thanks for the corrections, will embed them in v2.
Signature · 2 lines
With Best Regards, Andy Shevchenko