ACPICA: actbl2: change to be16/be32 types for big endian data
PATCH 1/1 ACPICA: actbl2: change to be16/be32 types for big endian data
Some of the fields in struct acpi_nfit_control_region are used in big endian format, and thus are generatng warnings from spare where the member is passed to one of the conversion functions.
Fix the following sparse warnings by changing the data types:
drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1468:41: warning: cast to restricted __le16 drivers/acpi/nfit/core.c:1502:41: warning: cast to restricted __le16 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted __be16 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32 drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted __be32
--- drivers/acpi/nfit/core.c | 8 ++++---- include/acpi/actbl2.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/acpi/nfit/core.c +4 -4
@@ -2194,15 +2194,15 @@ static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {/* enough info to uniquely specify an interleave set */ struct nfit_set_info {u64 region_offset; -u32 serial_number; +__be32 serial_number;u32 pad; };struct nfit_set_info2 {u64 region_offset; -u32 serial_number; -u16 vendor_id; -u16 manufacturing_date; +__be32 serial_number; +__be16 vendor_id; +__be16 manufacturing_date;u8 manufacturing_location;u8 reserved[31 ]; };
include/acpi/actbl2.h +9 -9
@@ -1716,18 +1716,18 @@ struct acpi_nfit_smbios {struct acpi_nfit_control_region {struct acpi_nfit_header header;u16 region_index; -u16 vendor_id; -u16 device_id; -u16 revision_id; -u16 subsystem_vendor_id; -u16 subsystem_device_id; -u16 subsystem_revision_id; +__be16 vendor_id; +__be16 device_id; +__be16 revision_id; +__be16 subsystem_vendor_id; +__be16 subsystem_device_id; +__be16 subsystem_revision_id;u8 valid_fields;u8 manufacturing_location; -u16 manufacturing_date; +__be16 manufacturing_date;u8 reserved[2 ];/* Reserved, must be zero */ -u32 serial_number; -u16 code; +__be32 serial_number; +__le16 code;u16 windows;u64 window_size;u64 command_offset;
Signature · 1 line
2.40.1
Rafael J. Wysocki
maintainerQuoted 64 lines · Ben Dooks
Some of the fields in struct
acpi_nfit_control_regionare used in big endian format, and thus are generatng warnings from spare where the member is passed to one of the conversion functions.Fix the following sparse warnings by changing the data types:
drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1403:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1412:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1421:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1430:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1440:25: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1449:41: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1468:41: warning: cast to restricted__le16drivers/acpi/nfit/core.c:1502:41: warning: cast to restricted__le16drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1527:41: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1792:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1794:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1795:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1798:33: warning: cast to restricted__be16drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32drivers/acpi/nfit/core.c:1799:33: warning: cast to restricted__be32
Quoted 1 line
Signed-off-by Ben Dooks <[email protected]>
First off, this falls under the ACPICA rule mentioned before.
Second, all ACPI is little-endian by the spec, so I'm not sure what is going on here.
Quoted 64 lines
--- drivers/acpi/nfit/core.c | 8 ++++---- include/acpi/actbl2.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-)drivers/acpi/nfit/core.c +4
-4@@ -2194,15 +2194,15 @@ static const struct attribute_group *acpi_nfit_region_attribute_groups[] = {/* enough info to uniquely specify an interleave set */ struct nfit_set_info {u64 region_offset; -u32 serial_number; +__be32 serial_number;u32 pad; };struct nfit_set_info2 {u64 region_offset; -u32 serial_number; -u16 vendor_id; -u16 manufacturing_date; +__be32 serial_number; +__be16 vendor_id; +__be16 manufacturing_date;u8 manufacturing_location;u8 reserved[31 ]; };include/acpi/actbl2.h +9
-10@@ -1716,18 +1716,18 @@ struct acpi_nfit_smbios {struct acpi_nfit_control_region {struct acpi_nfit_header header;u16 region_index; -u16 vendor_id; -u16 device_id; -u16 revision_id; -u16 subsystem_vendor_id; -u16 subsystem_device_id; -u16 subsystem_revision_id; +__be16 vendor_id; +__be16 device_id; +__be16 revision_id; +__be16 subsystem_vendor_id; +__be16 subsystem_device_id; +__be16 subsystem_revision_id;u8 valid_fields;u8 manufacturing_location; -u16 manufacturing_date; +__be16 manufacturing_date;u8 reserved[2 ];/* Reserved, must be zero */ -u32 serial_number; -u16 code; +__be32 serial_number; +__le16 code;u16 windows;u64 window_size;u64 command_offset; --2.40.1