Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp788369pxa; Sat, 1 Aug 2020 06:13:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjvzF9V0lOWNZT6/TZWQi9JEGfSa8kcPP89n3FxbELkNAFXaOVZoGs3zYVZyehBvfZq8aH X-Received: by 2002:a17:906:388b:: with SMTP id q11mr9033833ejd.100.1596287615620; Sat, 01 Aug 2020 06:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596287615; cv=none; d=google.com; s=arc-20160816; b=I8DrMCCwRSRkgYjJj6nfJxfB+IcDELEFqf/3TdiwfaynhD6zHgOCjcP9gPK6guDUBF yRPmdDSm+PFLDL4ThsZLYSM9aRKUrzbSE2JOlDbVA561AV0WaaqSZesn9Tjfbta5vFza yMeXGl93Us4bJBFH/pAhSMsHMJLmelyFqbNpJsFYJ38t8P8R6jfDuGzKh0efUpWGrqE9 JfltwXpCnWU1g7UaBXT1Fp8ReIwFIWWP6JLwrW7f+vvTpZeMnQHUDYc3a+AeVyQwhfCo g2rpl7DiCPCGta2pfJuJDP2NH2NyhVYQ9mGnOyCPIy64O1hb9Xx9yg/HdN9oa36RQ2fY r5tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=l3VOIW6NrsnoKDkF2ft9cZ2Nq+htChejUpxUolcbdMk=; b=hp03RTcyHJ72/Vwow5kmdU52K0i4HY2zDwrBqm1O9BMUiBJibXYA+k5jXLx/7S9aRI JomTtvL3stFv1r1YMnqywNyxXGNnNisZbi1qiedIYsvBmzQZwe90ZQBYOR7LdhV7VG7I PyjqnIqiY66lzEU83mw83BXqw6JYE12T/DCWR4GA3HsMfEFFq3hnpAnE4ZOOrNShSzMe MfzQ5TqroMDoJOlesK5YAuF/kBRn3HN2aKjNTdoCJmfxVNe6gVu6za8R7SBZvp8FiPwe QFdUr+Kco5H8+ZluekZYgAg6M9ZfU5eb6Lmzfy2eW2P5r5JphmTEPepe/iGD6kBPSHOL AYfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KEamH0x4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si5536457edt.286.2020.08.01.06.13.13; Sat, 01 Aug 2020 06:13:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KEamH0x4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbgHANNE (ORCPT + 99 others); Sat, 1 Aug 2020 09:13:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:35634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725778AbgHANND (ORCPT ); Sat, 1 Aug 2020 09:13:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 341392076A; Sat, 1 Aug 2020 13:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596287582; bh=/4onQlDCzaUFK/Z+RS1ZIvjtCTjj71c6KU35qFJyO1g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KEamH0x4S8u6xupbf9tA9j8S8W6D3HmNkcfzwBbhCro8L1TAqGQqpBu/W6RqBt7Si TAwMIN94oSGPIZKnvKBaFQxlc2RFyPdHm9kDkQJtW5EK+UYd02ErPGBmrjFzL0d8qG qa+YTfjeEFIcKbGZxWQ4vnexLM0b6rCZ8TYoaOIg= Date: Sat, 1 Aug 2020 15:12:47 +0200 From: Greg Kroah-Hartman To: Ivan Safonov Cc: devel@driverdev.osuosl.org, B K Karthik , linux-kernel@vger.kernel.org, Larry Finger Subject: Re: [PATCH] staging: r8188eu: replace rtw_netdev_priv define with inline function Message-ID: <20200801131247.GA2131407@kroah.com> References: <20200801094707.13449-1-insafonov@gmail.com> <20200801095108.GA2840539@kroah.com> <968d30fc-4e5f-b495-e986-b18b05e9a895@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <968d30fc-4e5f-b495-e986-b18b05e9a895@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 01, 2020 at 04:11:38PM +0300, Ivan Safonov wrote: > On 8/1/20 12:51 PM, Greg Kroah-Hartman wrote: > > On Sat, Aug 01, 2020 at 12:47:07PM +0300, Ivan Safonov wrote: > > > The function guarantees type checking of arguments and return value. > > > > > > Signed-off-by: Ivan Safonov > > > --- > > > drivers/staging/rtl8188eu/include/osdep_service.h | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h > > > index 31d897f1d21f..e0ccafdea9cd 100644 > > > --- a/drivers/staging/rtl8188eu/include/osdep_service.h > > > +++ b/drivers/staging/rtl8188eu/include/osdep_service.h > > > @@ -71,8 +71,10 @@ struct rtw_netdev_priv_indicator { > > > }; > > > struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv); > > > -#define rtw_netdev_priv(netdev) \ > > > - (((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv) > > > +static inline struct adapter *rtw_netdev_priv(struct net_device *dev) > > > +{ > > > + return (((struct rtw_netdev_priv_indicator *)netdev_priv(dev))->priv); > > > +} > > > void rtw_free_netdev(struct net_device *netdev); > > > > Is the cast really needed? > > (struct rtw_netdev_priv_indicator *) cast needed for access to '->priv'. > > The (struct adapter *) return type is a starting point for simplify > struct adapter *padapter = (struct adapter *)rtw_netdev_priv(dev); > constructions. Ah, sorry, missed that I thought this was a cast of netdev_priv(dev) itself, and not the additional structure. > > > > And no blank line before the next function prototype? > > In v2. > > > > > And is this really needed? Type checking is already happening as this > > is a "simple" macro, right? > > 1. The flexibility of macros is not needed here. > 2. The macro silently assigns ->priv to any pointer, while the function > indicates such a compile-time error. Ok, put that somewhere in the changelog please, saying how the existing macro does not provide any error checking. thanks, greg k-h