From: Marc Kleine-Budde <mkl@pengutronix.de>
To: kernel test robot <lkp@intel.com>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org, linux-can@vger.kernel.org
Subject: Re: drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to ...
Date: Wed, 18 May 2022 09:05:17 +0200 [thread overview]
Message-ID: <20220518070517.q53bjzo6lbnq3f2i@pengutronix.de> (raw)
In-Reply-To: <202205181414.n8QRDe8k-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 4977 bytes --]
On 18.05.2022 14:45:33, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 210e04ff768142b96452030c4c2627512b30ad95
> commit: eb79a267c9b3e608e7762a1b221428f37ace3aa3 can: mcp251xfd: rename all remaining occurrence to mcp251xfd
> date: 1 year, 8 months ago
> config: arm-randconfig-c002-20220518 (https://download.01.org/0day-ci/archive/20220518/202205181414.n8QRDe8k-lkp@intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eb79a267c9b3e608e7762a1b221428f37ace3aa3
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout eb79a267c9b3e608e7762a1b221428f37ace3aa3
> # save the config file
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:485:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c:511:1: warning: unused function 'mcp251xfd_chip_set_mode_nowait' [-Wunused-function]
> mcp251xfd_chip_set_mode_nowait(const struct mcp251xfd_priv *priv,
> ^
> 3 warnings generated.
> --
> >> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:485:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> 2 warnings generated.
>
>
> vim +481 drivers/net/can/spi/mcp251xfd/mcp251xfd.h
>
> 477
> 478 union mcp251xfd_tx_obj_load_buf {
> 479 struct __packed {
> 480 struct mcp251xfd_buf_cmd cmd;
> > 481 struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> 482 } nocrc;
> 483 struct __packed {
> 484 struct mcp251xfd_buf_cmd_crc cmd;
> 485 struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> 486 __be16 crc;
> 487 } crc;
> 488 } ____cacheline_aligned;
> 489
The structure layout is intentional as it describes the hardware
messages on the SPI bus. The functions accessing these structs use
appropriate put_unaligned_*() functions.
How to properly annotate these structs to silence the warnings?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: kbuild-all@lists.01.org
Subject: Re: drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to ...
Date: Wed, 18 May 2022 09:05:17 +0200 [thread overview]
Message-ID: <20220518070517.q53bjzo6lbnq3f2i@pengutronix.de> (raw)
In-Reply-To: <202205181414.n8QRDe8k-lkp@intel.com>
[-- Attachment #1: Type: text/plain, Size: 4979 bytes --]
On 18.05.2022 14:45:33, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 210e04ff768142b96452030c4c2627512b30ad95
> commit: eb79a267c9b3e608e7762a1b221428f37ace3aa3 can: mcp251xfd: rename all remaining occurrence to mcp251xfd
> date: 1 year, 8 months ago
> config: arm-randconfig-c002-20220518 (https://download.01.org/0day-ci/archive/20220518/202205181414.n8QRDe8k-lkp(a)intel.com/config)
> compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 853fa8ee225edf2d0de94b0dcbd31bea916e825e)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install arm cross compiling tool for clang build
> # apt-get install binutils-arm-linux-gnueabi
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=eb79a267c9b3e608e7762a1b221428f37ace3aa3
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout eb79a267c9b3e608e7762a1b221428f37ace3aa3
> # save the config file
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:485:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c:511:1: warning: unused function 'mcp251xfd_chip_set_mode_nowait' [-Wunused-function]
> mcp251xfd_chip_set_mode_nowait(const struct mcp251xfd_priv *priv,
> ^
> 3 warnings generated.
> --
> >> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> drivers/net/can/spi/mcp251xfd/mcp251xfd.h:485:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:483:2)' being packed, which can lead to unaligned accesses [-Wunaligned-access]
> struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> ^
> 2 warnings generated.
>
>
> vim +481 drivers/net/can/spi/mcp251xfd/mcp251xfd.h
>
> 477
> 478 union mcp251xfd_tx_obj_load_buf {
> 479 struct __packed {
> 480 struct mcp251xfd_buf_cmd cmd;
> > 481 struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> 482 } nocrc;
> 483 struct __packed {
> 484 struct mcp251xfd_buf_cmd_crc cmd;
> 485 struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
> 486 __be16 crc;
> 487 } crc;
> 488 } ____cacheline_aligned;
> 489
The structure layout is intentional as it describes the hardware
messages on the SPI bus. The functions accessing these structs use
appropriate put_unaligned_*() functions.
How to properly annotate these structs to silence the warnings?
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-05-18 7:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 6:45 drivers/net/can/spi/mcp251xfd/mcp251xfd.h:481:34: warning: field hw_tx_obj within 'struct mcp251xfd_tx_obj_load_buf::(unnamed at drivers/net/can/spi/mcp251xfd/mcp251xfd.h:479:2)' is less aligned than 'struct mcp251xfd_hw_tx_obj_raw' and is usually due to kernel test robot
2022-05-18 7:05 ` Marc Kleine-Budde [this message]
2022-05-18 7:05 ` Marc Kleine-Budde
2022-05-18 11:43 ` [PATCH] can: mcp251xfd: silence clang's -Wunaligned-access warning Vincent Mailhol
2022-05-18 11:43 ` Vincent Mailhol
2022-05-18 11:58 ` Marc Kleine-Budde
2022-05-18 11:58 ` Marc Kleine-Budde
2022-05-18 16:05 ` Nathan Chancellor
2022-05-18 16:05 ` Nathan Chancellor
2022-05-18 16:15 ` Vincent MAILHOL
2022-05-18 16:15 ` Vincent MAILHOL
2022-05-18 16:18 ` Nathan Chancellor
2022-05-18 16:18 ` Nathan Chancellor
2022-05-18 20:15 ` Marc Kleine-Budde
2022-05-18 20:15 ` Marc Kleine-Budde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220518070517.q53bjzo6lbnq3f2i@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.