staging: rtl8723bs: Remove ACPI table declaration
PATCH 1/1 staging: rtl8723bs: Remove ACPI table declaration
Clang warns that the acpi_id declaration is not going to be emitted in the final assembly:
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:25:36: warning: variable 'acpi_ids' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct acpi_device_id acpi_ids[] = {
^1 warning generated.
This is because it's marked as static const and it is not used anywhere in this file. Doing a git grep on this driver for 'acpi' shows that this declaration has been unused since the driver's initial induction. Remove it since it's not doing anything.
--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0 -6
@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ids[] = { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 }, - {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);static int rtw_drv_init (struct sdio_func *func,const struct sdio_device_id *id);static void rtw_dev_remove (struct sdio_func *func);
Signature · 1 line
2.19.0
Greg Kroah-Hartman
maintainerQuoted 26 lines · Nathan Chancellor
Clang warns that the
acpi_iddeclaration is not going to be emitted in the final assembly:
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:25:36: warning: variable 'acpi_ids' is not needed and will not be emitted [-Wunneeded-internal-declaration]static const struct acpi_device_id acpi_ids[] = { ^1 warning generated.
This is because it's marked as static const and it is not used anywhere in this file. Doing a git grep on this driver for 'acpi' shows that this declaration has been unused since the driver's initial induction. Remove it since it's not doing anything.
Signed-off-by Nathan Chancellor <[email protected]>--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-0
drivers/staging/rtl8723bs/os_dep/sdio_intf.c static const struct sdio_device_id sdio_ids[] = · line 31
Quoted 10 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-6@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ids[] = { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 }, - {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);
You just removed the ability for the driver to be automatically loaded if that acpi id is present.
Not good :(
I think you need to fix up your scripts, this is valid code...
greg k-h
Quoted 32 lines · Greg Kroah-Hartman
Quoted 31 lines · Nathan Chancellor
Clang warns that the
acpi_iddeclaration is not going to be emitted in the final assembly:
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:25:36: warning: variable 'acpi_ids' is not needed and will not be emitted [-Wunneeded-internal-declaration]static const struct acpi_device_id acpi_ids[] = { ^1 warning generated.
This is because it's marked as static const and it is not used anywhere in this file. Doing a git grep on this driver for 'acpi' shows that this declaration has been unused since the driver's initial induction. Remove it since it's not doing anything.
Signed-off-by Nathan Chancellor <[email protected]>--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-2@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ids[] = { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 },
Quoted 9 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c static const struct sdio_device_id sdio_ids[] = · line 31
Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-4- {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);You just removed the ability for the driver to be automatically loaded if that acpi id is present.
I am not sure I understand. Every instance of acpi_device_id that I looked at in the kernel before sending this patch uses MODULE_DEVICE_TABLE but then that acpi_device_id declaration is always used in the driver definition either under the acpi_match_table member or ids member depending on what type of driver it is. Should this one do that as well? Is that even possible with an sdio driver? I apologize if I am not making sense, I'm not super familiar with these interfaces.
I also read 'Documentation/acpi/enumeration.txt' which makes it seem like the declaration needs to be added to the device definition as well.
Quoted 4 lines
Not good :(
I think you need to fix up your scripts, this is valid code...
No scripts here, just a human interpreting warnings manually.
Quoted 1 line
greg k-h
Thanks for the review,
Nathan
Greg Kroah-Hartman
maintainerQuoted 43 lines · Nathan Chancellor
Quoted 32 lines · Greg Kroah-Hartman
Quoted 31 lines · Nathan Chancellor
Clang warns that the
acpi_iddeclaration is not going to be emitted in the final assembly:
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:25:36: warning: variable 'acpi_ids' is not needed and will not be emitted [-Wunneeded-internal-declaration]static const struct acpi_device_id acpi_ids[] = { ^1 warning generated.
This is because it's marked as static const and it is not used anywhere in this file. Doing a git grep on this driver for 'acpi' shows that this declaration has been unused since the driver's initial induction. Remove it since it's not doing anything.
Signed-off-by Nathan Chancellor <[email protected]>--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-2@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ids[] = { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 },Quoted 9 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c static const struct sdio_device_id sdio_ids[] = · line 31
Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-4- {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);You just removed the ability for the driver to be automatically loaded if that acpi id is present.
Quoted 5 lines
I am not sure I understand. Every instance of
acpi_device_idthat I looked at in the kernel before sending this patch usesMODULE_DEVICE_TABLEbut then thatacpi_device_iddeclaration is always used in the driver definition either under theacpi_match_tablemember or ids member depending on what type of driver it is. Should this one do that as well?
I don't know, but it's not always necessary.
Quoted 5 lines
Is that even possible with an sdio driver? I apologize if I am not making sense, I'm not super familiar with these interfaces.
I also read '
Documentation/acpi/enumeration.txt' which makes it seem like the declaration needs to be added to the device definition as well.
If it is a real acpi driver, yes, you need to actually register it with the acpi core.
But, if it is just using the auto-load functionality of "if this acpi string is found, load the module!" then the code is correct as-is.
Yeah, it's a hack, but does work and helps out for auto-loading drivers for "odd" hardware that is not always self-describing.
thanks,
greg k-h
Quoted 64 lines · Greg Kroah-Hartman
Quoted 43 lines · Nathan Chancellor
Quoted 32 lines · Greg Kroah-Hartman
Quoted 31 lines · Nathan Chancellor
Clang warns that the
acpi_iddeclaration is not going to be emitted in the final assembly:
drivers/staging/rtl8723bs/os_dep/sdio_intf.c:25:36: warning: variable 'acpi_ids' is not needed and will not be emitted [-Wunneeded-internal-declaration]static const struct acpi_device_id acpi_ids[] = { ^1 warning generated.
This is because it's marked as static const and it is not used anywhere in this file. Doing a git grep on this driver for 'acpi' shows that this declaration has been unused since the driver's initial induction. Remove it since it's not doing anything.
Signed-off-by Nathan Chancellor <[email protected]>--- drivers/staging/rtl8723bs/os_dep/sdio_intf.c | 6 ------ 1 file changed, 6 deletions(-)drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-2@@ -22,13 +22,7 @@ static const struct sdio_device_id sdio_ids[] = { SDIO_DEVICE(0x024c, 0xb723), }, { /* end: all zeroes */ }, }; -static const struct acpi_device_id acpi_ids[] = { - {"OBDA8723" ,0x0000 },Quoted 9 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c static const struct sdio_device_id sdio_ids[] = · line 31
Quoted 5 lines
drivers/staging/rtl8723bs/os_dep/sdio_intf.c +0
-4- {} -}; -MODULE_DEVICE_TABLE (sdio, sdio_ids); -MODULE_DEVICE_TABLE (acpi, acpi_ids);You just removed the ability for the driver to be automatically loaded if that acpi id is present.
Quoted 5 lines
I am not sure I understand. Every instance of
acpi_device_idthat I looked at in the kernel before sending this patch usesMODULE_DEVICE_TABLEbut then thatacpi_device_iddeclaration is always used in the driver definition either under theacpi_match_tablemember or ids member depending on what type of driver it is. Should this one do that as well?I don't know, but it's not always necessary.
Quoted 5 lines
Is that even possible with an sdio driver? I apologize if I am not making sense, I'm not super familiar with these interfaces.
I also read '
Documentation/acpi/enumeration.txt' which makes it seem like the declaration needs to be added to the device definition as well.If it is a real acpi driver, yes, you need to actually register it with the acpi core.
But, if it is just using the auto-load functionality of "if this acpi string is found, load the module!" then the code is correct as-is.
Quoted 6 lines
Yeah, it's a hack, but does work and helps out for auto-loading drivers for "odd" hardware that is not always self-describing.
thanks,
greg k-h
Thank you for the explanation, I appreciate that and I'll keep it in mind should I run across this kind of warning in the future. I'll send a v2 now that silences this warning through the '__maybe_unused' attribute like a few other commits that deal with this warning.
Nathan