2021-09-02 08:38:12

by Cabiddu, Giovanni

[permalink] [raw]
Subject: [PATCH] crypto: qat - remove unneeded packed attribute

Remove packed attribute from structures that do not need to be packed.
These are just used internally and not shared with firmware.

This also fixes a series of warning when compiling the driver with the
flag -Waddress-of-packed-member, similar to the following:

drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c:102:28: warning: taking address of packed member 'csr_ops' of class or structure 'adf_hw_device_data' may result in an unaligned pointer value

Signed-off-by: Giovanni Cabiddu <[email protected]>
Reported-by: kernel test robot <[email protected]>
Reviewed-by: Wojciech Ziemba <[email protected]>
---
drivers/crypto/qat/qat_common/adf_accel_devices.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h
index 38c0af6d4e43..5d4281c95866 100644
--- a/drivers/crypto/qat/qat_common/adf_accel_devices.h
+++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h
@@ -42,13 +42,13 @@ struct adf_bar {
resource_size_t base_addr;
void __iomem *virt_addr;
resource_size_t size;
-} __packed;
+};

struct adf_accel_msix {
struct msix_entry *entries;
char **names;
u32 num_entries;
-} __packed;
+};

struct adf_accel_pci {
struct pci_dev *pci_dev;
@@ -56,7 +56,7 @@ struct adf_accel_pci {
struct adf_bar pci_bars[ADF_PCI_MAX_BARS];
u8 revid;
u8 sku;
-} __packed;
+};

enum dev_state {
DEV_DOWN = 0,
@@ -96,7 +96,7 @@ struct adf_hw_device_class {
const char *name;
const enum adf_device_type type;
u32 instances;
-} __packed;
+};

struct arb_info {
u32 arb_cfg;
@@ -195,7 +195,7 @@ struct adf_hw_device_data {
u8 num_logical_accel;
u8 num_engines;
u8 min_iov_compat_ver;
-} __packed;
+};

/* CSR write macro */
#define ADF_CSR_WR(csr_base, csr_offset, val) \
@@ -261,5 +261,5 @@ struct adf_accel_dev {
};
bool is_vf;
u32 accel_id;
-} __packed;
+};
#endif
--
2.31.1


2021-09-17 12:07:04

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: qat - remove unneeded packed attribute

On Thu, Sep 02, 2021 at 09:34:59AM +0100, Giovanni Cabiddu wrote:
> Remove packed attribute from structures that do not need to be packed.
> These are just used internally and not shared with firmware.
>
> This also fixes a series of warning when compiling the driver with the
> flag -Waddress-of-packed-member, similar to the following:
>
> drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c:102:28: warning: taking address of packed member 'csr_ops' of class or structure 'adf_hw_device_data' may result in an unaligned pointer value
>
> Signed-off-by: Giovanni Cabiddu <[email protected]>
> Reported-by: kernel test robot <[email protected]>
> Reviewed-by: Wojciech Ziemba <[email protected]>
> ---
> drivers/crypto/qat/qat_common/adf_accel_devices.h | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt