* [PATCH v3 0/2] Read _SUB from ACPI to be able to identify firmware
@ 2022-06-27 15:51 ` Stefan Binding
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, linux-kernel, patches, Stefan Binding
CS35L41 has a DSP which is able to run firmware, as well as a tuning file.
Different systems may want to use different firmwares and tuning files, and
some firmwares/tunings may not be compatible with other systems.
To allow a system to select the correct fimware/tuning, we can read an _SUB
from the ACPI. This _SUB can then be used to uniquely identify the system
in the firmware/tuning file name.
Add a helper function which reads the _SUB, so this can be used by other
parts in the future.
Add support inside the CS35L41 ASoC driver to read this _SUB, and save it
appropriately.
Changes since v2:
- Fix error in function prototype
Changes since v1:
- Add length validation for SSID String
- Rename API
- Allocate memory inside API
- Use ACPI_HANDLE macro instead of ACPI_COMPANION
- Improve error handling
Stefan Binding (2):
ACPI: utils: Add api to read _SUB from ACPI
ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware
drivers/acpi/utils.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/acpi.h | 6 ++++++
sound/soc/codecs/cs35l41.c | 24 ++++++++++++++++++++++++
3 files changed, 68 insertions(+)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 0/2] Read _SUB from ACPI to be able to identify firmware
@ 2022-06-27 15:51 ` Stefan Binding
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, Stefan Binding, linux-kernel, patches
CS35L41 has a DSP which is able to run firmware, as well as a tuning file.
Different systems may want to use different firmwares and tuning files, and
some firmwares/tunings may not be compatible with other systems.
To allow a system to select the correct fimware/tuning, we can read an _SUB
from the ACPI. This _SUB can then be used to uniquely identify the system
in the firmware/tuning file name.
Add a helper function which reads the _SUB, so this can be used by other
parts in the future.
Add support inside the CS35L41 ASoC driver to read this _SUB, and save it
appropriately.
Changes since v2:
- Fix error in function prototype
Changes since v1:
- Add length validation for SSID String
- Rename API
- Allocate memory inside API
- Use ACPI_HANDLE macro instead of ACPI_COMPANION
- Improve error handling
Stefan Binding (2):
ACPI: utils: Add api to read _SUB from ACPI
ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware
drivers/acpi/utils.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/acpi.h | 6 ++++++
sound/soc/codecs/cs35l41.c | 24 ++++++++++++++++++++++++
3 files changed, 68 insertions(+)
--
2.25.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
2022-06-27 15:51 ` Stefan Binding
@ 2022-06-27 15:51 ` Stefan Binding
-1 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, linux-kernel, patches, Stefan Binding
Add a wrapper function to read the _SUB string from ACPI.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
drivers/acpi/utils.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/acpi.h | 6 ++++++
2 files changed, 44 insertions(+)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 3a9773a09e19..4ef9ee4ad0d8 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -291,6 +291,44 @@ int acpi_get_local_address(acpi_handle handle, u32 *addr)
}
EXPORT_SYMBOL(acpi_get_local_address);
+#define ACPI_MAX_SUB_BUF_SIZE 9
+
+const char *acpi_get_subsystem_id(acpi_handle handle)
+{
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
+ acpi_status status;
+ const char *sub;
+
+ status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
+ if (ACPI_FAILURE(status)) {
+ acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
+ return ERR_PTR(-ENODATA);
+ }
+
+ obj = buffer.pointer;
+ if (obj->type == ACPI_TYPE_STRING) {
+ if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
+ strlen(obj->string.pointer) > 0) {
+ sub = kstrdup(obj->string.pointer, GFP_KERNEL);
+ if (!sub)
+ sub = ERR_PTR(-ENOMEM);
+ } else {
+ acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
+ strlen(obj->string.pointer));
+ sub = ERR_PTR(-EINVAL);
+ }
+ } else {
+ acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
+ sub = ERR_PTR(-EINVAL);
+ }
+
+ acpi_os_free(buffer.pointer);
+
+ return sub;
+}
+EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
+
acpi_status
acpi_evaluate_reference(acpi_handle handle,
acpi_string pathname,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4f82a5bc6d98..968a187f14f0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -762,6 +762,7 @@ static inline u64 acpi_arch_get_root_pointer(void)
#endif
int acpi_get_local_address(acpi_handle handle, u32 *addr);
+const char *acpi_get_subsystem_id(acpi_handle handle);
#else /* !CONFIG_ACPI */
@@ -1023,6 +1024,11 @@ static inline int acpi_get_local_address(acpi_handle handle, u32 *addr)
return -ENODEV;
}
+static inline const char *acpi_get_subsystem_id(acpi_handle handle)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline int acpi_register_wakeup_handler(int wake_irq,
bool (*wakeup)(void *context), void *context)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
@ 2022-06-27 15:51 ` Stefan Binding
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, Stefan Binding, linux-kernel, patches
Add a wrapper function to read the _SUB string from ACPI.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
drivers/acpi/utils.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/acpi.h | 6 ++++++
2 files changed, 44 insertions(+)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 3a9773a09e19..4ef9ee4ad0d8 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -291,6 +291,44 @@ int acpi_get_local_address(acpi_handle handle, u32 *addr)
}
EXPORT_SYMBOL(acpi_get_local_address);
+#define ACPI_MAX_SUB_BUF_SIZE 9
+
+const char *acpi_get_subsystem_id(acpi_handle handle)
+{
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ union acpi_object *obj;
+ acpi_status status;
+ const char *sub;
+
+ status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
+ if (ACPI_FAILURE(status)) {
+ acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
+ return ERR_PTR(-ENODATA);
+ }
+
+ obj = buffer.pointer;
+ if (obj->type == ACPI_TYPE_STRING) {
+ if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
+ strlen(obj->string.pointer) > 0) {
+ sub = kstrdup(obj->string.pointer, GFP_KERNEL);
+ if (!sub)
+ sub = ERR_PTR(-ENOMEM);
+ } else {
+ acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
+ strlen(obj->string.pointer));
+ sub = ERR_PTR(-EINVAL);
+ }
+ } else {
+ acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
+ sub = ERR_PTR(-EINVAL);
+ }
+
+ acpi_os_free(buffer.pointer);
+
+ return sub;
+}
+EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
+
acpi_status
acpi_evaluate_reference(acpi_handle handle,
acpi_string pathname,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 4f82a5bc6d98..968a187f14f0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -762,6 +762,7 @@ static inline u64 acpi_arch_get_root_pointer(void)
#endif
int acpi_get_local_address(acpi_handle handle, u32 *addr);
+const char *acpi_get_subsystem_id(acpi_handle handle);
#else /* !CONFIG_ACPI */
@@ -1023,6 +1024,11 @@ static inline int acpi_get_local_address(acpi_handle handle, u32 *addr)
return -ENODEV;
}
+static inline const char *acpi_get_subsystem_id(acpi_handle handle)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline int acpi_register_wakeup_handler(int wake_irq,
bool (*wakeup)(void *context), void *context)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware
2022-06-27 15:51 ` Stefan Binding
@ 2022-06-27 15:51 ` Stefan Binding
-1 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, linux-kernel, patches, Stefan Binding
When loading firmware, wm_adsp uses a number of parameters to
determine the path of the firmware and tuning files to load.
One of these parameters is system_name.
Add support in cs35l41 to read this system name from the ACPI
_SUB ID in order to uniquely identify the firmware and tuning
mapped to a particular system.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
sound/soc/codecs/cs35l41.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 8766e19d85f1..9ab016094b32 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -6,6 +6,7 @@
//
// Author: David Rhodes <david.rhodes@cirrus.com>
+#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
@@ -1142,6 +1143,24 @@ static int cs35l41_dsp_init(struct cs35l41_private *cs35l41)
return ret;
}
+static int cs35l41_probe_acpi(struct cs35l41_private *cs35l41)
+{
+ acpi_handle handle = ACPI_HANDLE(cs35l41->dev);
+ const char *sub;
+
+ /* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */
+ if (!handle)
+ return 0;
+
+ sub = acpi_get_subsystem_id(handle);
+ if (IS_ERR(sub))
+ return PTR_ERR(sub);
+
+ cs35l41->dsp.system_name = sub;
+ dev_dbg(cs35l41->dev, "Susystem ID: %s\n", cs35l41->dsp.system_name);
+ return 0;
+}
+
int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *hw_cfg)
{
u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;
@@ -1270,6 +1289,10 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *
goto err;
}
+ ret = cs35l41_probe_acpi(cs35l41);
+ if (ret < 0)
+ goto err;
+
ret = cs35l41_dsp_init(cs35l41);
if (ret < 0)
goto err;
@@ -1316,6 +1339,7 @@ void cs35l41_remove(struct cs35l41_private *cs35l41)
pm_runtime_disable(cs35l41->dev);
regmap_write(cs35l41->regmap, CS35L41_IRQ1_MASK1, 0xFFFFFFFF);
+ kfree(cs35l41->dsp.system_name);
wm_adsp2_remove(&cs35l41->dsp);
cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/2] ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware
@ 2022-06-27 15:51 ` Stefan Binding
0 siblings, 0 replies; 10+ messages in thread
From: Stefan Binding @ 2022-06-27 15:51 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: linux-acpi, alsa-devel, Stefan Binding, linux-kernel, patches
When loading firmware, wm_adsp uses a number of parameters to
determine the path of the firmware and tuning files to load.
One of these parameters is system_name.
Add support in cs35l41 to read this system name from the ACPI
_SUB ID in order to uniquely identify the firmware and tuning
mapped to a particular system.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
sound/soc/codecs/cs35l41.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/sound/soc/codecs/cs35l41.c b/sound/soc/codecs/cs35l41.c
index 8766e19d85f1..9ab016094b32 100644
--- a/sound/soc/codecs/cs35l41.c
+++ b/sound/soc/codecs/cs35l41.c
@@ -6,6 +6,7 @@
//
// Author: David Rhodes <david.rhodes@cirrus.com>
+#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
@@ -1142,6 +1143,24 @@ static int cs35l41_dsp_init(struct cs35l41_private *cs35l41)
return ret;
}
+static int cs35l41_probe_acpi(struct cs35l41_private *cs35l41)
+{
+ acpi_handle handle = ACPI_HANDLE(cs35l41->dev);
+ const char *sub;
+
+ /* If there is no ACPI_HANDLE, there is no ACPI for this system, return 0 */
+ if (!handle)
+ return 0;
+
+ sub = acpi_get_subsystem_id(handle);
+ if (IS_ERR(sub))
+ return PTR_ERR(sub);
+
+ cs35l41->dsp.system_name = sub;
+ dev_dbg(cs35l41->dev, "Susystem ID: %s\n", cs35l41->dsp.system_name);
+ return 0;
+}
+
int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *hw_cfg)
{
u32 regid, reg_revid, i, mtl_revid, int_status, chipid_match;
@@ -1270,6 +1289,10 @@ int cs35l41_probe(struct cs35l41_private *cs35l41, const struct cs35l41_hw_cfg *
goto err;
}
+ ret = cs35l41_probe_acpi(cs35l41);
+ if (ret < 0)
+ goto err;
+
ret = cs35l41_dsp_init(cs35l41);
if (ret < 0)
goto err;
@@ -1316,6 +1339,7 @@ void cs35l41_remove(struct cs35l41_private *cs35l41)
pm_runtime_disable(cs35l41->dev);
regmap_write(cs35l41->regmap, CS35L41_IRQ1_MASK1, 0xFFFFFFFF);
+ kfree(cs35l41->dsp.system_name);
wm_adsp2_remove(&cs35l41->dsp);
cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type);
--
2.25.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
2022-06-27 15:51 ` Stefan Binding
@ 2022-06-27 23:31 ` kernel test robot
-1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-06-27 23:31 UTC (permalink / raw)
To: Stefan Binding, Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: kbuild-all, linux-acpi, alsa-devel, Stefan Binding, linux-kernel,
patches
Hi Stefan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on broonie-sound/for-next linus/master v5.19-rc4 next-20220627]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220628/202206280722.5wvfmDeu-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/7dd124b65442fd6622e7df2949795f735d8356be
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
git checkout 7dd124b65442fd6622e7df2949795f735d8356be
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/utils.c:17:
drivers/acpi/utils.c: In function 'acpi_get_subsystem_id':
>> drivers/acpi/utils.c:317:49: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318 | strlen(obj->string.pointer));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
include/linux/acpi.h:1172:46: note: in definition of macro 'acpi_handle_err'
1172 | acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
| ^~~
drivers/acpi/utils.c:317:68: note: format string is defined here
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ~^
| |
| int
| %ld
vim +317 drivers/acpi/utils.c
295
296 const char *acpi_get_subsystem_id(acpi_handle handle)
297 {
298 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
299 union acpi_object *obj;
300 acpi_status status;
301 const char *sub;
302
303 status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
304 if (ACPI_FAILURE(status)) {
305 acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
306 return ERR_PTR(-ENODATA);
307 }
308
309 obj = buffer.pointer;
310 if (obj->type == ACPI_TYPE_STRING) {
311 if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
312 strlen(obj->string.pointer) > 0) {
313 sub = kstrdup(obj->string.pointer, GFP_KERNEL);
314 if (!sub)
315 sub = ERR_PTR(-ENOMEM);
316 } else {
> 317 acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
318 strlen(obj->string.pointer));
319 sub = ERR_PTR(-EINVAL);
320 }
321 } else {
322 acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
323 sub = ERR_PTR(-EINVAL);
324 }
325
326 acpi_os_free(buffer.pointer);
327
328 return sub;
329 }
330 EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
331
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
@ 2022-06-27 23:31 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-06-27 23:31 UTC (permalink / raw)
To: Stefan Binding, Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: alsa-devel, kbuild-all, patches, Stefan Binding, linux-kernel,
linux-acpi
Hi Stefan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on broonie-sound/for-next linus/master v5.19-rc4 next-20220627]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20220628/202206280722.5wvfmDeu-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/7dd124b65442fd6622e7df2949795f735d8356be
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
git checkout 7dd124b65442fd6622e7df2949795f735d8356be
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/utils.c:17:
drivers/acpi/utils.c: In function 'acpi_get_subsystem_id':
>> drivers/acpi/utils.c:317:49: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
318 | strlen(obj->string.pointer));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| size_t {aka long unsigned int}
include/linux/acpi.h:1172:46: note: in definition of macro 'acpi_handle_err'
1172 | acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
| ^~~
drivers/acpi/utils.c:317:68: note: format string is defined here
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ~^
| |
| int
| %ld
vim +317 drivers/acpi/utils.c
295
296 const char *acpi_get_subsystem_id(acpi_handle handle)
297 {
298 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
299 union acpi_object *obj;
300 acpi_status status;
301 const char *sub;
302
303 status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
304 if (ACPI_FAILURE(status)) {
305 acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
306 return ERR_PTR(-ENODATA);
307 }
308
309 obj = buffer.pointer;
310 if (obj->type == ACPI_TYPE_STRING) {
311 if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
312 strlen(obj->string.pointer) > 0) {
313 sub = kstrdup(obj->string.pointer, GFP_KERNEL);
314 if (!sub)
315 sub = ERR_PTR(-ENOMEM);
316 } else {
> 317 acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
318 strlen(obj->string.pointer));
319 sub = ERR_PTR(-EINVAL);
320 }
321 } else {
322 acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
323 sub = ERR_PTR(-EINVAL);
324 }
325
326 acpi_os_free(buffer.pointer);
327
328 return sub;
329 }
330 EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
331
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
2022-06-27 15:51 ` Stefan Binding
@ 2022-06-28 0:12 ` kernel test robot
-1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-06-28 0:12 UTC (permalink / raw)
To: Stefan Binding, Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: kbuild-all, linux-acpi, alsa-devel, Stefan Binding, linux-kernel,
patches
Hi Stefan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on broonie-sound/for-next linus/master v5.19-rc4 next-20220627]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-rhel-8.3-syz (https://download.01.org/0day-ci/archive/20220628/202206280813.F9ukvWAK-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/7dd124b65442fd6622e7df2949795f735d8356be
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
git checkout 7dd124b65442fd6622e7df2949795f735d8356be
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/utils.c:17:
drivers/acpi/utils.c: In function 'acpi_get_subsystem_id':
>> drivers/acpi/utils.c:317:49: warning: format '%d' expects argument of type 'int', but argument 4 has type '__kernel_size_t' {aka 'long unsigned int'} [-Wformat=]
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/acpi.h:1172:46: note: in definition of macro 'acpi_handle_err'
1172 | acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
| ^~~
drivers/acpi/utils.c:317:68: note: format string is defined here
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ~^
| |
| int
| %ld
vim +317 drivers/acpi/utils.c
295
296 const char *acpi_get_subsystem_id(acpi_handle handle)
297 {
298 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
299 union acpi_object *obj;
300 acpi_status status;
301 const char *sub;
302
303 status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
304 if (ACPI_FAILURE(status)) {
305 acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
306 return ERR_PTR(-ENODATA);
307 }
308
309 obj = buffer.pointer;
310 if (obj->type == ACPI_TYPE_STRING) {
311 if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
312 strlen(obj->string.pointer) > 0) {
313 sub = kstrdup(obj->string.pointer, GFP_KERNEL);
314 if (!sub)
315 sub = ERR_PTR(-ENOMEM);
316 } else {
> 317 acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
318 strlen(obj->string.pointer));
319 sub = ERR_PTR(-EINVAL);
320 }
321 } else {
322 acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
323 sub = ERR_PTR(-EINVAL);
324 }
325
326 acpi_os_free(buffer.pointer);
327
328 return sub;
329 }
330 EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
331
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI
@ 2022-06-28 0:12 ` kernel test robot
0 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2022-06-28 0:12 UTC (permalink / raw)
To: Stefan Binding, Rafael J . Wysocki, Len Brown, Mark Brown, Liam Girdwood
Cc: alsa-devel, kbuild-all, patches, Stefan Binding, linux-kernel,
linux-acpi
Hi Stefan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on broonie-sound/for-next linus/master v5.19-rc4 next-20220627]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-rhel-8.3-syz (https://download.01.org/0day-ci/archive/20220628/202206280813.F9ukvWAK-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/7dd124b65442fd6622e7df2949795f735d8356be
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Stefan-Binding/Read-_SUB-from-ACPI-to-be-able-to-identify-firmware/20220627-235448
git checkout 7dd124b65442fd6622e7df2949795f735d8356be
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/acpi/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/acpi/utils.c:17:
drivers/acpi/utils.c: In function 'acpi_get_subsystem_id':
>> drivers/acpi/utils.c:317:49: warning: format '%d' expects argument of type 'int', but argument 4 has type '__kernel_size_t' {aka 'long unsigned int'} [-Wformat=]
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/acpi.h:1172:46: note: in definition of macro 'acpi_handle_err'
1172 | acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__)
| ^~~
drivers/acpi/utils.c:317:68: note: format string is defined here
317 | acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
| ~^
| |
| int
| %ld
vim +317 drivers/acpi/utils.c
295
296 const char *acpi_get_subsystem_id(acpi_handle handle)
297 {
298 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
299 union acpi_object *obj;
300 acpi_status status;
301 const char *sub;
302
303 status = acpi_evaluate_object(handle, METHOD_NAME__SUB, NULL, &buffer);
304 if (ACPI_FAILURE(status)) {
305 acpi_handle_debug(handle, "Reading ACPI _SUB failed: %#x\n", status);
306 return ERR_PTR(-ENODATA);
307 }
308
309 obj = buffer.pointer;
310 if (obj->type == ACPI_TYPE_STRING) {
311 if (strlen(obj->string.pointer) < ACPI_MAX_SUB_BUF_SIZE &&
312 strlen(obj->string.pointer) > 0) {
313 sub = kstrdup(obj->string.pointer, GFP_KERNEL);
314 if (!sub)
315 sub = ERR_PTR(-ENOMEM);
316 } else {
> 317 acpi_handle_err(handle, "ACPI _SUB Length %d is Invalid\n",
318 strlen(obj->string.pointer));
319 sub = ERR_PTR(-EINVAL);
320 }
321 } else {
322 acpi_handle_warn(handle, "Warning ACPI _SUB did not return a string\n");
323 sub = ERR_PTR(-EINVAL);
324 }
325
326 acpi_os_free(buffer.pointer);
327
328 return sub;
329 }
330 EXPORT_SYMBOL_GPL(acpi_get_subsystem_id);
331
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-06-28 0:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 15:51 [PATCH v3 0/2] Read _SUB from ACPI to be able to identify firmware Stefan Binding
2022-06-27 15:51 ` Stefan Binding
2022-06-27 15:51 ` [PATCH v3 1/2] ACPI: utils: Add api to read _SUB from ACPI Stefan Binding
2022-06-27 15:51 ` Stefan Binding
2022-06-27 23:31 ` kernel test robot
2022-06-27 23:31 ` kernel test robot
2022-06-28 0:12 ` kernel test robot
2022-06-28 0:12 ` kernel test robot
2022-06-27 15:51 ` [PATCH v3 2/2] ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware Stefan Binding
2022-06-27 15:51 ` Stefan Binding
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.