From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-1096172-1517921295-2-11197595945641211604 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.001, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, LANGUAGES roende, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='com', MailFrom='org' X-Spam-charsets: plain='utf-8' X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: linux-usb-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1517921295; b=gfUfMi4FMQjKFHMicyiykmMgBnvpnBkYNLE6wJQxkkNp+UK 80mHF1dxHDPNRNN35GYwilRow1tK8u/qBiQ0A7vQYexCSgE9WTBKbv341rEQ/j79 IPqqIk9BHSy3XkCclNCqvOlq7+oIPZramwQi+EVUMp4lYD6Ya1phNKqUA0EiWqLh uHb0p8Z6AVMuZhVwsuAxuIaxhLq1WP5J3t8qJpRECwrQtigWeFUJTSTBpLQdpd5Q J5gWOh4dMjlmeTJxBP4SY53BPe5E5r9+3LHCIe68rgugNgMVFtxjVnawqhAucacq StbDzU3PshLjIvdyEQe4ofimlF+VKCDRqRgUbtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=subject:to:cc:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding:sender:list-id; s=arctest; t= 1517921295; bh=aCPS+IIigTojCaAL3srH79hbHh0f38PJXsGNKQDClYE=; b=S MOhxlWBVRskf0ZwKX0ATjIkhEACQWhEp3z9uYpKOdzWrdNNUC904heVZb0Dkpi7D QDvtxnQDLrnn9rmXZqG5GNSmb4Rxo6ITOogvzLd9mTsM/5NyByXMo5FCdhtq2w0d +Fq9EPi3GnLtpOkBpmsY5bbLkIu6Y7rxjJXc9OsbPOfnGJOLXBH0Mhu73un/l/S9 mBpXNuf4EXaFd7UiBki+yAwJz4wIEXnl/bP+a/OxXI547Jne+/DhNRAvRRdtkLRf YxVYQjTGpn+p4UvlI4VnD6nvOe0+3mKh1JFeVFat+OPoeJVJSS8lr0PXy9dOmcAM xcEPoTZZNLSRCFGaHIpiQ== ARC-Authentication-Results: i=1; mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=arm.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=arm.com header.result=pass header_is_org_domain=yes Authentication-Results: mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=arm.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=arm.com header.result=pass header_is_org_domain=yes Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752975AbeBFMsK (ORCPT ); Tue, 6 Feb 2018 07:48:10 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36312 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbeBFMsB (ORCPT ); Tue, 6 Feb 2018 07:48:01 -0500 Subject: Re: [PATCH/RFC 4/6] mm: Add NO_DMA dummies for DMA pool API To: Geert Uytterhoeven , Christoph Hellwig , Marek Szyprowski , Arnd Bergmann , Mark Brown , Richard Weinberger Cc: Felipe Balbi , Greg Kroah-Hartman , "James E . J . Bottomley" , "Martin K . Petersen" , iommu@lists.linux-foundation.org, linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org References: <1517912092-15470-1-git-send-email-geert@linux-m68k.org> <1517912092-15470-5-git-send-email-geert@linux-m68k.org> From: Robin Murphy Message-ID: <61f0970a-c0aa-9b6f-74c7-d63be1e477ac@arm.com> Date: Tue, 6 Feb 2018 12:47:56 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1517912092-15470-5-git-send-email-geert@linux-m68k.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-usb-owner@vger.kernel.org X-Mailing-List: linux-usb@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Hi Geert, On 06/02/18 10:14, Geert Uytterhoeven wrote: > Add dummies for dma{,m}_pool_{create,destroy,alloc,free}(), to allow > compile-testing if NO_DMA=y. > > This prevents the following from showing up later: > > ERROR: "dma_pool_destroy" [drivers/usb/mtu3/mtu3.ko] undefined! > ERROR: "dma_pool_free" [drivers/usb/mtu3/mtu3.ko] undefined! > ERROR: "dma_pool_alloc" [drivers/usb/mtu3/mtu3.ko] undefined! > ERROR: "dma_pool_create" [drivers/usb/mtu3/mtu3.ko] undefined! > ERROR: "dma_pool_destroy" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! > ERROR: "dma_pool_free" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! > ERROR: "dma_pool_alloc" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! > ERROR: "dma_pool_create" [drivers/scsi/hisi_sas/hisi_sas_main.ko] undefined! > ERROR: "dma_pool_alloc" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! > ERROR: "dma_pool_free" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! > ERROR: "dma_pool_create" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! > ERROR: "dma_pool_destroy" [drivers/mailbox/bcm-pdc-mailbox.ko] undefined! > > Signed-off-by: Geert Uytterhoeven > --- > include/linux/dmapool.h | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/include/linux/dmapool.h b/include/linux/dmapool.h > index 53ba737505df31c7..adeb5e56c3ad73a8 100644 > --- a/include/linux/dmapool.h > +++ b/include/linux/dmapool.h > @@ -16,6 +16,7 @@ > > struct device; > > +#ifdef CONFIG_HAS_DMA > struct dma_pool *dma_pool_create(const char *name, struct device *dev, > size_t size, size_t align, size_t allocation); > > @@ -23,6 +24,17 @@ void dma_pool_destroy(struct dma_pool *pool); > > void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, > dma_addr_t *handle); > +void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); > +#else /* !CONFIG_HAS_DMA */ > +static inline struct dma_pool *dma_pool_create(const char *name, > + struct device *dev, size_t size, size_t align, size_t allocation) > +{ return NULL; } > +static inline void dma_pool_destroy(struct dma_pool *pool) { } > +static inline void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, > + dma_addr_t *handle) { return NULL; } > +static inline void dma_pool_free(struct dma_pool *pool, void *vaddr, > + dma_addr_t addr) { } > +#endif /* !CONFIG_HAS_DMA */ > > static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, > dma_addr_t *handle) > @@ -30,14 +42,19 @@ static inline void *dma_pool_zalloc(struct dma_pool *pool, gfp_t mem_flags, > return dma_pool_alloc(pool, mem_flags | __GFP_ZERO, handle); > } > > -void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t addr); > - > /* > * Managed DMA pool > */ > +#ifdef CONFIG_HAS_DMA > struct dma_pool *dmam_pool_create(const char *name, struct device *dev, > size_t size, size_t align, size_t allocation); > void dmam_pool_destroy(struct dma_pool *pool); > +#else /* !CONFIG_HAS_DMA */ > +static inline struct dma_pool *dmam_pool_create(const char *name, > + struct device *dev, size_t size, size_t align, size_t allocation) > +{ return NULL; } > +static inline void dmam_pool_destroy(struct dma_pool *pool) { } > +#endif /* !CONFIG_HAS_DMA */ Nit: It might be tidier to add *all* the stubs down here so that there only need be a single #ifdef, then move the dma_pool_zalloc definition outside at the end (where we might eventually get rid of it anyway). Other than that, though, I think I agree with the series in general - more COMPILE_TEST is always good from the point of view of weeding out drivers using architecture-specific DMA API internals which aren't part of the proper generic interface. Robin. > > #endif > >