From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760954AbcIPKlt (ORCPT ); Fri, 16 Sep 2016 06:41:49 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35105 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757081AbcIPKlr (ORCPT ); Fri, 16 Sep 2016 06:41:47 -0400 Subject: Re: [PATCH 01/10] staging: slicoss: slic.h: add a macro IOMEM_GET_FIELDADDR to fix sparse warnings To: Greg KH References: <2fdea4da0036cd13aa0879ffcf86e3303013d52a.1473821899.git.sironhide0null@gmail.com> <20160916075259.GB1858@kroah.com> Cc: liodot@gmail.com, charrer@alacritech.com, linux-kernel@vger.kernel.org From: zerons Message-ID: <157cd71a-bce4-03f3-bc76-635f493c0051@gmail.com> Date: Fri, 16 Sep 2016 18:41:38 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160916075259.GB1858@kroah.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org these marcos are used to get the value or address of a member of a `__iomem` structure. GET_FIELDADDR is like &iomem_obj->field, and GET_FIELD32 is iomem_obj->u32val, GET_FIELD64 is iomem_obj->u64val. If patch the .c file directly, the source gets into a mess. On 09/16/2016 03:52 PM, Greg KH wrote: > On Tue, Sep 13, 2016 at 07:59:50PM -0700, Peng Sun wrote: >> Signed-off-by: Peng Sun >> --- >> drivers/staging/slicoss/slic.h | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h >> index fe1d2ce..7c23190 100644 >> --- a/drivers/staging/slicoss/slic.h >> +++ b/drivers/staging/slicoss/slic.h >> @@ -539,6 +539,13 @@ 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 UPDATE_STATS(largestat, newstat, oldstat) \ >> { \ >> if ((newstat) < (oldstat)) \ >> -- >> 2.7.4 > > Wait, what does this patch on its own do? Why create this macro? > > greg k-h >