Skip to contentSkip to conversation

PNP: make pnp_eisa_id_to_string() take __be32 id

PATCH Applied Ben Dooks 2 participants 3 messages Jun 17 – Jun 24

Subsystems (2)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 PNP: make pnp_eisa_id_to_string() take __be32 id

The pnp_eisa_id_to_string() should take a __be32 id as it passes it immediately to be32_to_cpu(). Change the type of this to fix the following sparse warning:

drivers/pnp/support.c:42:14: warning: cast to restricted __be32

---
 drivers/pnp/base.h    | 2 +-
 drivers/pnp/support.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pnp/base.h +1 -1
index b342570d0236..7b666b6ac40e 100644
@@ -11,7 +11,7 @@ extern const struct bus_type pnp_bus_type;
 int pnp_register_protocol(struct pnp_protocol *protocol);
 
 #define PNP_EISA_ID_MASK 0x7fffffff
-void pnp_eisa_id_to_string(u32 id, char *str);
+void pnp_eisa_id_to_string(__be32 id, char *str);
 struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
 			      const char *pnpid);
 struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
drivers/pnp/support.c +2 -2
index f6c866851769..07c9844680ac 100644
@@ -37,9 +37,9 @@ EXPORT_SYMBOL(pnp_is_active);
  * Functionally similar to acpi_ex_eisa_id_to_string(), but that's
  * buried in the ACPI CA, and we can't depend on it being present.
  */
-void pnp_eisa_id_to_string(u32 id, char *str)
+void pnp_eisa_id_to_string(__be32 _id, char *str)
 {
-	id = be32_to_cpu(id);
+	u32 id = be32_to_cpu(_id);
 
 	/*
 	 * According to the specs, the first three characters are five-bit
Signature · 1 line
2.37.2.352.g3c44437643
maintainer Applied
#1 lore raw
Quoted 33 lines · Ben Dooks

The pnp_eisa_id_to_string() should take a __be32 id as it passes it immediately to be32_to_cpu(). Change the type of this to fix the following sparse warning:

drivers/pnp/support.c:42:14: warning: cast to restricted __be32

---
 drivers/pnp/base.h    | 2 +-
 drivers/pnp/support.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pnp/base.h +1 -1
index b342570d0236..7b666b6ac40e 100644
@@ -11,7 +11,7 @@ extern const struct bus_type pnp_bus_type;
 int pnp_register_protocol(struct pnp_protocol *protocol);
 
 #define PNP_EISA_ID_MASK 0x7fffffff
-void pnp_eisa_id_to_string(u32 id, char *str);
+void pnp_eisa_id_to_string(__be32 id, char *str);
 struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
                              const char *pnpid);
 struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
drivers/pnp/support.c +0 -0
index f6c866851769..07c9844680ac 100644
@@ -37,9 +37,9 @@ EXPORT_SYMBOL(pnp_is_active);
  * Functionally similar to acpi_ex_eisa_id_to_string(), but that's
  * buried in the ACPI CA, and we can't depend on it being present.

drivers/pnp/support.c EXPORT_SYMBOL(pnp_is_active);

Quoted 10 lines
drivers/pnp/support.c +2 -3
  */
-void pnp_eisa_id_to_string(u32 id, char *str)
+void pnp_eisa_id_to_string(__be32 _id, char *str)
 {
-       id = be32_to_cpu(id);
+       u32 id = be32_to_cpu(_id);
 
        /*
         * According to the specs, the first three characters are five-bit
--

Applied as 7.2-rc material, thanks!

#2 lore raw
Quoted 42 lines · Rafael J. Wysocki
Quoted 40 lines · Ben Dooks

The pnp_eisa_id_to_string() should take a __be32 id as it passes it immediately to be32_to_cpu(). Change the type of this to fix the following sparse warning:

drivers/pnp/support.c:42:14: warning: cast to restricted __be32

---
 drivers/pnp/base.h    | 2 +-
 drivers/pnp/support.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/pnp/base.h +1 -1
index b342570d0236..7b666b6ac40e 100644
@@ -11,7 +11,7 @@ extern const struct bus_type pnp_bus_type;
 int pnp_register_protocol(struct pnp_protocol *protocol);
 
 #define PNP_EISA_ID_MASK 0x7fffffff
-void pnp_eisa_id_to_string(u32 id, char *str);
+void pnp_eisa_id_to_string(__be32 id, char *str);
 struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *, int id,
                              const char *pnpid);
 struct pnp_card *pnp_alloc_card(struct pnp_protocol *, int id, char *pnpid);
drivers/pnp/support.c +2 -2
index f6c866851769..07c9844680ac 100644
@@ -37,9 +37,9 @@ EXPORT_SYMBOL(pnp_is_active);
  * Functionally similar to acpi_ex_eisa_id_to_string(), but that's
  * buried in the ACPI CA, and we can't depend on it being present.
  */
-void pnp_eisa_id_to_string(u32 id, char *str)
+void pnp_eisa_id_to_string(__be32 _id, char *str)
 {
-       id = be32_to_cpu(id);
+       u32 id = be32_to_cpu(_id);
 
Quoted 5 lines

drivers/pnp/support.c EXPORT_SYMBOL(pnp_is_active);

Quoted 3 lines
drivers/pnp/support.c +0 -1
        /*
         * According to the specs, the first three characters are five-bit
--

Applied as 7.2-rc material, thanks!

And dropped because it causes sparse to complain:

https://lore.kernel.org/linux-acpi/[email protected]/