From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756454AbcIMLAr (ORCPT ); Tue, 13 Sep 2016 07:00:47 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:33286 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbcIMLAo (ORCPT ); Tue, 13 Sep 2016 07:00:44 -0400 From: Peng Sun To: liodot@gmail.com, charrer@alacritech.com, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Peng Sun Subject: [PATCH 1/2] staging: slicoss: slic.h: add several macros to fix sparse warnings Date: Tue, 13 Sep 2016 04:00:21 -0700 Message-Id: <1347561039d52f50b973269e013aff4de27c3839.1473764379.git.sironhide0null@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: 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 | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h index fe1d2ce..cfed4ef 100644 --- a/drivers/staging/slicoss/slic.h +++ b/drivers/staging/slicoss/slic.h @@ -539,6 +539,51 @@ static inline void slic_flush_write(struct adapter *adapter) ioread32(adapter->regs + SLIC_REG_HOSTID); } +#define IOMEM_GET_FIELDADDR(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + (void __iomem *)_base; \ +}) + +#define IOMEM_GET_FIELD32(base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + ioread32(_base); \ +}) + +#define IOMEM_SET_FIELD32(value, base, member) \ +({ \ + char __iomem *_base = (char __iomem *)base; \ + _base += offsetof(typeof(*base), member); \ + 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; \ + _base += offsetof(typeof(*base), member); \ + u64 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