From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758269AbcINDAa (ORCPT ); Tue, 13 Sep 2016 23:00:30 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34627 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757466AbcINDAV (ORCPT ); Tue, 13 Sep 2016 23:00:21 -0400 From: Peng Sun To: liodot@gmail.com, charrer@alacritech.com, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Peng Sun Subject: [PATCH 04/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELD64 to fix sparse warnings Date: Tue, 13 Sep 2016 19:59:53 -0700 Message-Id: <62de4cf8ac3f837d2828cbee3b075b9cbe102bcd.1473821899.git.sironhide0null@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: <974f8bea8404695a9440f19b3812300f0ded32b5.1473821899.git.sironhide0null@gmail.com> References: <2fdea4da0036cd13aa0879ffcf86e3303013d52a.1473821899.git.sironhide0null@gmail.com> <2fcefc8b7d4b917dc6dfa32238e47c266428ade0.1473821899.git.sironhide0null@gmail.com> <974f8bea8404695a9440f19b3812300f0ded32b5.1473821899.git.sironhide0null@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Peng Sun --- drivers/staging/slicoss/slic.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index 4c22863..b9595c4 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -560,6 +560,31 @@ static inline void slic_flush_write(struct adapter *adapter) iowrite32(value, _base); \ }) +#ifdef CONFIG_64BIT +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + readq(_base); \ +}) +#else +#define IOMEM_GET_FIELD64(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + u64 val; \ + _base += offsetof(typeof(*base), member); \ + val = ((u64)ioread8(_base + 7)) << 56; \ + val += ((u64)ioread8(_base + 6)) << 48; \ + val += ((u64)ioread8(_base + 5)) << 40; \ + val += ((u64)ioread8(_base + 4)) << 32; \ + val += ((u64)ioread8(_base + 3)) << 24; \ + val += ((u64)ioread8(_base + 2)) << 16; \ + val += ((u64)ioread8(_base + 1)) << 8; \ + val += ioread8(_base); \ + le64_to_cpu(val); \ +}) +#endif + #define UPDATE_STATS(largestat, newstat, oldstat) \ { \ if ((newstat) < (oldstat)) \ -- 2.7.4