From patchwork Mon Feb 4 21:17:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10796649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFD0E13B5 for ; Mon, 4 Feb 2019 21:18:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FB462B1EB for ; Mon, 4 Feb 2019 21:18:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93DB62B340; Mon, 4 Feb 2019 21:18:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3928D2B500 for ; Mon, 4 Feb 2019 21:18:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729615AbfBDVSE (ORCPT ); Mon, 4 Feb 2019 16:18:04 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42920 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729224AbfBDVSD (ORCPT ); Mon, 4 Feb 2019 16:18:03 -0500 Received: by mail-pf1-f194.google.com with SMTP id 64so503617pfr.9 for ; Mon, 04 Feb 2019 13:18:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sRRk1/NqVGloHjW6gXCGaQJmxB0HmoNqVSOjkft3r3o=; b=DnXeFUwpKM0a36jWO53m2UE6pNooI8urEZ+Xox7OvHEaR/jm7eXz7isx6YIvp2fUpO +ZSofAl+u2YE5DXzxYre8CKCJ9hH+O5Krbjs1exRwBAAsaAc4fB630Vbc7RnX0BHE5CX JLdHlv96+qKsIeD/qfRDzgpdbgGhXACyEV2/xI7hthTFWxSPMOsWv66EIk7sHu9Fl++x tF6ZZm46IKT4Bug3k3MDN9+1yJH0YMcM/XqAeSH8XdLNu9ckD8u+i+n6hx2GTAdzJ0NP /LfnV2g20YILe0CPzI2s21QKkMb2SR2L+/rRDxbg8J0RxkXqX8F1KE/928NZhWebol4+ 3FHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sRRk1/NqVGloHjW6gXCGaQJmxB0HmoNqVSOjkft3r3o=; b=TicUoSmFZhVG00982sUDGhp4S5lrPDltk55FZdjCiXf6NxVRjePmZLkh04WKFJXNKy kTw3Wkuc2/aOmaUUhhpOV/rzU+dn4TyoOezvhPkwuoGHN0aF33BOGHOP9r+emyPc56mN f1MwEAdNK/7bYJdvMYF6EhqloGvmGiemHquSPNmY0+k9Qg7SitkTvCS1Y3yhkuRCG8iC 4B4lK2uAs3O/fbZc47bGwZHrvL2F1UpMm/OWUI44HtJTuuNbjkFnU3Uy20Int6Rst5cT oe5w0Epwthf7AADqZfoe0yK+XEXx2wyL/EVM4tggr0T1ot9nOqaxYe8VwZh7Xm3d8f0m YYkQ== X-Gm-Message-State: AHQUAuY5mBt+cb/9CZqN8KjxGs7YLgvVlcMuoJdCHIPZ0h7E6Z1Q6ZbA l19PxYHZJA0gtitYr2GrporgRP0IFK0= X-Google-Smtp-Source: AHgI3Iayy2ZIg9qB91GmHr739fuQhSZxtxE+3LZOcsvV+c9p6JtPQLUNxRKleSGyMIYSlpqaRZDM4g== X-Received: by 2002:a63:94:: with SMTP id 142mr1309223pga.74.1549315081985; Mon, 04 Feb 2019 13:18:01 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id z62sm1812092pfl.33.2019.02.04.13.17.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 13:18:00 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1gqlct-0005KZ-FJ; Mon, 04 Feb 2019 14:17:59 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe , Parav Pandit Subject: [PATCH 4/8] RDMA/device: Get rid of reg_state Date: Mon, 4 Feb 2019 14:17:47 -0700 Message-Id: <20190204211751.19001-5-jgg@ziepe.ca> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204211751.19001-1-jgg@ziepe.ca> References: <20190204211751.19001-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe This really has no purpose anymore, refcount can be used to tell if the device is still registered. Keeping it around just invites mis-use. Signed-off-by: Jason Gunthorpe Reviewed-by: Parav Pandit --- drivers/infiniband/core/device.c | 8 ++------ include/rdma/ib_verbs.h | 6 ------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 286a41cd4cda78..c846b5f7abb9d8 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -243,7 +243,7 @@ static void ib_device_release(struct device *device) { struct ib_device *dev = container_of(device, struct ib_device, dev); - WARN_ON(dev->reg_state == IB_DEV_REGISTERED); + WARN_ON(refcount_read(&dev->refcount)); ib_cache_release_one(dev); ib_security_release_port_pkey_list(dev); kfree(dev->port_pkey_list); @@ -316,8 +316,7 @@ EXPORT_SYMBOL(_ib_alloc_device); void ib_dealloc_device(struct ib_device *device) { WARN_ON(!list_empty(&device->client_data_list)); - WARN_ON(device->reg_state != IB_DEV_UNREGISTERED && - device->reg_state != IB_DEV_UNINITIALIZED); + WARN_ON(refcount_read(&device->refcount)); rdma_restrack_clean(device); put_device(&device->dev); } @@ -601,7 +600,6 @@ int ib_register_device(struct ib_device *device, const char *name) } refcount_set(&device->refcount, 1); - device->reg_state = IB_DEV_REGISTERED; list_for_each_entry(client, &client_list, list) if (!add_client_context(device, client) && client->add) @@ -672,8 +670,6 @@ void ib_unregister_device(struct ib_device *device) } write_unlock_irqrestore(&device->client_data_lock, flags); up_write(&lists_rwsem); - - device->reg_state = IB_DEV_UNREGISTERED; } EXPORT_SYMBOL(ib_unregister_device); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 2e1f1e885ee502..76138ef4f839ea 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2558,12 +2558,6 @@ struct ib_device { struct kobject *ports_kobj; struct list_head port_list; - enum { - IB_DEV_UNINITIALIZED, - IB_DEV_REGISTERED, - IB_DEV_UNREGISTERED - } reg_state; - int uverbs_abi_ver; u64 uverbs_cmd_mask; u64 uverbs_ex_cmd_mask;