From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BF23C41604 for ; Tue, 6 Oct 2020 07:53:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26CC120789 for ; Tue, 6 Oct 2020 07:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601970832; bh=/LkdZ2nk205rG/aXlex3QVzJL5fCTWMjJajxqBqPClk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=MZO3+Y3/Ow5230K1X+RxgS0GjshUOle+UNj1H7ARmz4dRPfm8Okbz8U1rEEMVeIOL 6h2p7SAHUO8uCRhoH6Kt/yQo+sfc1oDoQb6KM/toiUHZfwrzgSpF/YB0ozbYl+A5gE N/FRgJhZzeRcFVYzQs/LnHtnj+HvLMm/8ykXH66w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726769AbgJFHxv (ORCPT ); Tue, 6 Oct 2020 03:53:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:53660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgJFHxv (ORCPT ); Tue, 6 Oct 2020 03:53:51 -0400 Received: from localhost (unknown [213.57.247.131]) (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 425BC20760; Tue, 6 Oct 2020 07:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601970830; bh=/LkdZ2nk205rG/aXlex3QVzJL5fCTWMjJajxqBqPClk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xfsxDYQuU+MqjKgc4sCu0vaV2/iK+1G6P+wnTdjcWSyrhSRtABvybMDkf8w8pFa7o 586pMp6BQgAP0lVoK9Yn9ag917KsV+uK3v6jpL2qyc0fE/1A9Lie1ZtnZPL9NA/rN0 5LXR05yw4gsf16lGeu80qkXLH7ogrKw0ukGGbQS8= Date: Tue, 6 Oct 2020 10:53:45 +0300 From: Leon Romanovsky To: Christoph Hellwig Cc: Doug Ledford , Jason Gunthorpe , Adit Ranadive , Ariel Elior , Bernard Metzler , Christian Benvenuti , Dennis Dalessandro , Devesh Sharma , Faisal Latif , Gal Pressman , Lijun Ou , linux-rdma@vger.kernel.org, Michal Kalderon , Mike Marciniszyn , Naresh Kumar PBS , Nelson Escobar , Parav Pandit , Parvi Kaustubhi , Potnuri Bharat Teja , Selvin Xavier , Shiraz Saleem , Somnath Kotur , Sriharsha Basavapatna , VMware PV-Drivers , Weihang Li , "Wei Hu(Xavier)" , Yishai Hadas , Zhu Yanjun Subject: Re: [PATCH rdma-next v2] RDMA: Explicitly pass in the dma_device to ib_register_device Message-ID: <20201006075345.GK1874917@unreal> References: <20201006073229.2347811-1-leon@kernel.org> <20201006073554.GA16894@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201006073554.GA16894@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Oct 06, 2020 at 08:35:54AM +0100, Christoph Hellwig wrote: > > + WARN_ON(!IS_ENABLED(CONFIG_DMA_VIRT_OPS) && !dma_device); > > + if (!dma_device) { > > /* > > - * The caller did not provide custom DMA operations. Use the > > - * DMA mapping operations of the parent device. > > + * If the caller does not provide a DMA capable device then the > > + * IB device will be used. In this case the caller should fully > > + * setup the ibdev for DMA. This usually means using > > + * dma_virt_ops. > > */ > > + device->dev.dma_ops = &dma_virt_ops; > > + dma_device = &device->dev; > > The lack of the if probably means this will fail to link now when > CONFIG_DMA_VIRT_OPS is not set. This also seems to not remove the > dma_virt_ops assignment in the callers. I expect to see this during driver development/testing. It is not worth to make if() case id device won't be operable. Thanks