Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3042753ybi; Sun, 28 Jul 2019 23:44:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGObgax3phyKL5AP80mOK/NUQnCZDnwnrS8O4jucmkd/iXAIu/2iR1c7rx1bishShETGTh X-Received: by 2002:a63:6c7:: with SMTP id 190mr101505921pgg.7.1564382658502; Sun, 28 Jul 2019 23:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564382658; cv=none; d=google.com; s=arc-20160816; b=tiZKkHerx09KdoMrFZNifpVmFBmum6xtarz/AmcOrufBTclYmmr7+t0NnUUg9F/x/g C0Uv33xUjpenNA+FeyWNPb85HabiVjhgQytKdFkuAO7xEWB8vk7xF+nHiWy0sOnIvNc6 drPS0Ljgq6zaVsJ8/aNunqEpdOeCaK6Ql8biUYxl1u7JX5EgXCNqDC/BLyu/ImYYzFlu rOUSpIM0P2JS3bDURWEyf4L1xq8nwXGPRGGaEzhjNCnkropnuCJiIyox0CtM+j899O/L vpquA4TrcwuB1/fFi4ev1a/k9zrI09xdA0RX+5GUeHWTU/P9R/65VhK35Mnk4yOn3DKt Qzmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=6Q73dlBLavcvnY2HBnuaIzEk28ehoNkH62ZiXKqCykU=; b=cVUO7y65FxiS3+zWHAqff35Skuzb3oVjozRPTou1U6NFsRQ4/41sK1gW0mCCql0/VQ q2Hjwp/rb9mJP8buvizUyOWxf/m+AG0Lqm1zNnMhaO/Nl5dQy2WkW+H4yZySgs24PoDW hYZMxLI5JRaOTArbIuF6o7HZ87sOXEN5EEJLpCRGTI9hmBXOvKyg2398XfIyURVKrpcz 7b77V2KSEW69ivWIBmgdXCWBE/l8ULb1YJC0IjbdZNipD+VtCWCWv5Fof1GBI2CsuhsB GqpzpqOQ0kCHTvIG0exyBuXRMdQniroJrYMM6w1bXPzODD+o5p/G66gJoIzOk00f6L6W vTRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si30823288pfq.160.2019.07.28.23.44.03; Sun, 28 Jul 2019 23:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726716AbfG2GbZ (ORCPT + 99 others); Mon, 29 Jul 2019 02:31:25 -0400 Received: from smtprelay0238.hostedemail.com ([216.40.44.238]:38460 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725934AbfG2GbY (ORCPT ); Mon, 29 Jul 2019 02:31:24 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id AC68383777ED; Mon, 29 Jul 2019 06:31:22 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::,RULES_HIT:41:355:379:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2693:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3873:4250:4321:5007:6742:7875:7904:10004:10400:10848:11026:11232:11473:11658:11914:12043:12114:12296:12297:12438:12555:12740:12760:12895:13069:13311:13357:13439:14096:14097:14180:14181:14659:14721:21060:21080:21627:30054:30090:30091,0,RBL:23.242.196.136:@perches.com:.lbl8.mailshell.net-62.8.0.180 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: star39_8018288ec7e4b X-Filterd-Recvd-Size: 3529 Received: from XPS-9350.home (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf05.hostedemail.com (Postfix) with ESMTPA; Mon, 29 Jul 2019 06:31:20 +0000 (UTC) Message-ID: Subject: Re: [EXTERNAL][PATCH 1/5] PCI: Convert pci_resource_to_user to a weak function From: Joe Perches To: Paul Burton , Denis Efremov Cc: Bjorn Helgaas , "David S. Miller" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Ralf Baechle , James Hogan , Michal Simek , "linux-mips@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "sparclinux@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Sun, 28 Jul 2019 23:31:18 -0700 In-Reply-To: <20190728224953.kezztdozc6k24ya3@pburton-laptop> References: <20190728202213.15550-1-efremov@linux.com> <20190728202213.15550-2-efremov@linux.com> <20190728224953.kezztdozc6k24ya3@pburton-laptop> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2019-07-28 at 22:49 +0000, Paul Burton wrote: > Hi Denis, > > On Sun, Jul 28, 2019 at 11:22:09PM +0300, Denis Efremov wrote: > > diff --git a/include/linux/pci.h b/include/linux/pci.h > > index 9e700d9f9f28..1a19d0151b0a 100644 > > --- a/include/linux/pci.h > > +++ b/include/linux/pci.h > > @@ -1870,25 +1870,13 @@ static inline const char *pci_name(const struct pci_dev *pdev) > > return dev_name(&pdev->dev); > > } > > > > - > > /* > > * Some archs don't want to expose struct resource to userland as-is > > * in sysfs and /proc > > */ > > -#ifdef HAVE_ARCH_PCI_RESOURCE_TO_USER > > -void pci_resource_to_user(const struct pci_dev *dev, int bar, > > - const struct resource *rsrc, > > - resource_size_t *start, resource_size_t *end); > > -#else > > -static inline void pci_resource_to_user(const struct pci_dev *dev, int bar, > > - const struct resource *rsrc, resource_size_t *start, > > - resource_size_t *end) > > -{ > > - *start = rsrc->start; > > - *end = rsrc->end; > > -} > > -#endif /* HAVE_ARCH_PCI_RESOURCE_TO_USER */ > > - > > +void __weak pci_resource_to_user(const struct pci_dev *dev, int bar, > > + const struct resource *rsrc, > > + resource_size_t *start, resource_size_t *end); > > > > /* > > * The world is not perfect and supplies us with broken PCI devices. > > This is wrong - using __weak on the declaration in a header will cause > the weak attribute to be applied to all implementations too (presuming > the C files containing the implementations include the header). You then > get whichever impleentation the linker chooses, which isn't necessarily > the one you wanted. > > checkpatch.pl should produce an error about this - see the > WEAK_DECLARATION error introduced in commit 619a908aa334 ("checkpatch: > add error on use of attribute((weak)) or __weak declarations"). Unfortunately, checkpatch is pretty stupid and only emits this on single line declarations.