linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH, net-next] qede: hide 32-bit compile warning
@ 2016-08-26 15:37 Arnd Bergmann
  2016-08-26 16:51 ` Joe Perches
  2016-08-31  6:35 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-08-26 15:37 UTC (permalink / raw)
  To: Yuval Mintz, Ariel Elior, everest-linux-l2
  Cc: Arnd Bergmann, David S. Miller, Sudarsana Reddy Kalluru,
	Manish Chopra, netdev, linux-kernel

The addition of the per-queue statistics introduced a harmless warning
on all 32-bit architectures:

drivers/net/ethernet/qlogic/qede/qede_ethtool.c: In function 'qede_get_ethtool_stats':
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
      buf[cnt++] = QEDE_TQSTATS_DATA(edev,
                               ^
drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:22: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      buf[cnt++] = QEDE_TQSTATS_DATA(edev,
                      ^
This changes the cast to 'void *' to shut up the warning, which
avoids the assumptions on the size of the pointer type.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 68db9ec2df07 ("qede: Add support for per-queue stats.")
---
 drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index 4d45945bc34c..14d5328e6ac9 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -60,7 +60,7 @@ static const struct {
 };
 
 #define QEDE_TQSTATS_DATA(dev, sindex, tssid, tcid) \
-	(*((u64 *)(((u64)(&dev->fp_array[tssid].txqs[tcid])) +\
+	(*((u64 *)(((void *)(&dev->fp_array[tssid].txqs[tcid])) +\
 		   qede_tqstats_arr[(sindex)].offset)))
 
 static const struct {
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH, net-next] qede: hide 32-bit compile warning
  2016-08-26 15:37 [PATCH, net-next] qede: hide 32-bit compile warning Arnd Bergmann
@ 2016-08-26 16:51 ` Joe Perches
  2016-08-31  6:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2016-08-26 16:51 UTC (permalink / raw)
  To: Arnd Bergmann, Yuval Mintz, Ariel Elior, everest-linux-l2
  Cc: David S. Miller, Sudarsana Reddy Kalluru, Manish Chopra, netdev,
	linux-kernel

On Fri, 2016-08-26 at 17:37 +0200, Arnd Bergmann wrote:
> The addition of the per-queue statistics introduced a harmless warning
> on all 32-bit architectures:
> 
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c: In function 'qede_get_ethtool_stats':
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       buf[cnt++] = QEDE_TQSTATS_DATA(edev,
>                                ^
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:22: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       buf[cnt++] = QEDE_TQSTATS_DATA(edev,
>                       ^
> This changes the cast to 'void *' to shut up the warning, which
> avoids the assumptions on the size of the pointer type.
[]
> diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
[]
> @@ -60,7 +60,7 @@ static const struct {
>  };
>  
>  #define QEDE_TQSTATS_DATA(dev, sindex, tssid, tcid) \
> -	(*((u64 *)(((u64)(&dev->fp_array[tssid].txqs[tcid])) +\
> +	(*((u64 *)(((void *)(&dev->fp_array[tssid].txqs[tcid])) +\
>  		   qede_tqstats_arr[(sindex)].offset)))

That thing is perhaps overly complicated.
Maybe a static inline like below would be easier to read:

static inline u64
QEDE_TQSTATS_DATA(const struct qede_dev *edev,
		  int sindex, int tssid, int tcid)
{
	struct qede_tx_queue *txq = &edev->fp_array[tssid].txqs[tcid];
	size_t offset = qede_tqstats_arr[sindex].offset;

	return *(u64 *)((unsigned long)txq + offset);
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH, net-next] qede: hide 32-bit compile warning
  2016-08-26 15:37 [PATCH, net-next] qede: hide 32-bit compile warning Arnd Bergmann
  2016-08-26 16:51 ` Joe Perches
@ 2016-08-31  6:35 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-08-31  6:35 UTC (permalink / raw)
  To: arnd
  Cc: Yuval.Mintz, Ariel.Elior, everest-linux-l2, sudarsana.kalluru,
	manish.chopra, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>
Date: Fri, 26 Aug 2016 17:37:53 +0200

> The addition of the per-queue statistics introduced a harmless warning
> on all 32-bit architectures:
> 
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c: In function 'qede_get_ethtool_stats':
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:31: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
>       buf[cnt++] = QEDE_TQSTATS_DATA(edev,
>                                ^
> drivers/net/ethernet/qlogic/qede/qede_ethtool.c:244:22: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
>       buf[cnt++] = QEDE_TQSTATS_DATA(edev,
>                       ^
> This changes the cast to 'void *' to shut up the warning, which
> avoids the assumptions on the size of the pointer type.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: 68db9ec2df07 ("qede: Add support for per-queue stats.")

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-31  6:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 15:37 [PATCH, net-next] qede: hide 32-bit compile warning Arnd Bergmann
2016-08-26 16:51 ` Joe Perches
2016-08-31  6:35 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).