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=-2.4 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 93EDBC54FD0 for ; Tue, 21 Apr 2020 12:08:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6024C206A5 for ; Tue, 21 Apr 2020 12:08:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="N5hGOnvm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgDUMIu (ORCPT ); Tue, 21 Apr 2020 08:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726018AbgDUMIu (ORCPT ); Tue, 21 Apr 2020 08:08:50 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31DD9C061A41 for ; Tue, 21 Apr 2020 05:08:50 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id t3so14205356qkg.1 for ; Tue, 21 Apr 2020 05:08:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3FhjQ0bL3FcnfxRJzwU2birDevO5bn+c/zKDG6q4ojY=; b=N5hGOnvmCUPCUcy5qlF8TnpMPyS5NrUDPwMg5ziycNEn6xaHz+vUgwmOfqMDzovFqM KitZtnSid0LTXK7MGOmRnsmIOeaZ8zMh8hq9FUSjgBj2njm4ACScqR6yvId/hNp2z7lE wiu/eXTamuCQ8Z1XkqPoim29eogc0Pv45t865NTWzrAty898+iGQ27i9IVdEaBjMRZ+7 bqmvujumQb3naOHgLwk9ik7dvsnrtaVuYuDMjn7Go91BpmZE8ImRtGMy8ULNmFRKJGWd Gi6J7w2usbq0oBlSR50+KazBhWUS918rRZzzuLs5bEsFq2YkWA3DQ0og6zkppm2QjEnY 2BZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3FhjQ0bL3FcnfxRJzwU2birDevO5bn+c/zKDG6q4ojY=; b=ejF4O29DLFtRZZsr/2oi8dRVCENMiw3rA+jXDSgMwIT2vKCQzl0EOCMrO1d9EY6+lG VKUMPJKkIDOcyiZXP9Bm+ftCjSngP9gEdd1eU7btBIPL5szywa7MqVcEcOnt//iktvjk Bo7Xo7pUW6ego7DyL7J7zAKaGUtWyr/AkXVr+9EC4B8Zmr7eaifO/2oGf5PGSVpGBNML FmfNEQ+rKYWU8pjhG3xiUUEit1ayl2W1Y+S+N4Kg7Xy/ZlGcqzlwZl/38X1ThBy2Rw44 ylqze/tZVImjhtf/Up0Hf7fiIzs6njoh82ZjAcLYBkMQbvS7kDyJbK+s7H9IWrQOJSxE h5Rg== X-Gm-Message-State: AGi0PuZrg6hnhLjQekQl/e4yay2wDlsKmCPl5DMW7mCBgt8eVtMz54Rh UM2ISC+NDzeeEtPAcY2vqNkTIw== X-Google-Smtp-Source: APiQypIj0hH3787ssUZ6URQylyWbMjelHPcljWGv7eRHlsoDIsY260nUcnsi5hmoo4c/Ctks8RpB0A== X-Received: by 2002:a37:7906:: with SMTP id u6mr19843423qkc.489.1587470929241; Tue, 21 Apr 2020 05:08:49 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-57-212.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.57.212]) by smtp.gmail.com with ESMTPSA id o27sm1583527qko.71.2020.04.21.05.08.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Apr 2020 05:08:48 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1jQrho-0007vI-1O; Tue, 21 Apr 2020 09:08:48 -0300 Date: Tue, 21 Apr 2020 09:08:48 -0300 From: Jason Gunthorpe To: Jeff Kirsher Cc: davem@davemloft.net, gregkh@linuxfoundation.org, Dave Ertman , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com, parav@mellanox.com, galpress@amazon.com, selvin.xavier@broadcom.com, sriharsha.basavapatna@broadcom.com, benve@cisco.com, bharat@chelsio.com, xavier.huwei@huawei.com, yishaih@mellanox.com, leonro@mellanox.com, mkalderon@marvell.com, aditr@vmware.com, ranjani.sridharan@linux.intel.com, pierre-louis.bossart@linux.intel.com, Kiran Patil , Andrew Bowers Subject: Re: [net-next v2 1/9] Implementation of Virtual Bus Message-ID: <20200421120848.GR26002@ziepe.ca> References: <20200421080235.6515-1-jeffrey.t.kirsher@intel.com> <20200421080235.6515-2-jeffrey.t.kirsher@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200421080235.6515-2-jeffrey.t.kirsher@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Apr 21, 2020 at 01:02:27AM -0700, Jeff Kirsher wrote: > +/** > + * virtbus_release_device - Destroy a virtbus device > + * @_dev: device to release > + */ > +static void virtbus_release_device(struct device *_dev) > +{ > + struct virtbus_device *vdev = to_virtbus_dev(_dev); > + int ida = vdev->id; > + > + vdev->release(vdev); > + ida_simple_remove(&virtbus_dev_ida, ida); > +} > + > +/** > + * virtbus_register_device - add a virtual bus device > + * @vdev: virtual bus device to add > + */ > +int virtbus_register_device(struct virtbus_device *vdev) > +{ > + int ret; > + > + if (!vdev->release) { > + dev_err(&vdev->dev, "virtbus_device MUST have a .release callback that does something.\n"); > + return -EINVAL; > + } > + > + /* Don't return on error here before the device_initialize. > + * All error paths out of this function must perform a > + * put_device(), unless the release callback does not exist, > + * so that the .release() callback is called, and thus have > + * to occur after the device_initialize. > + */ > + device_initialize(&vdev->dev); > + > + vdev->dev.bus = &virtual_bus_type; > + vdev->dev.release = virtbus_release_device; > + > + /* All device IDs are automatically allocated */ > + ret = ida_simple_get(&virtbus_dev_ida, 0, 0, GFP_KERNEL); > + > + if (ret < 0) { > + dev_err(&vdev->dev, "get IDA idx for virtbus device failed!\n"); > + goto device_pre_err; This still has the problem I described, why are you resending without fixing? Jason