From patchwork Tue Feb 2 19:08:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Chiang X-Patchwork-Id: 76491 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o12JCr7w004604 for ; Tue, 2 Feb 2010 19:12:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932241Ab0BBTLw (ORCPT ); Tue, 2 Feb 2010 14:11:52 -0500 Received: from g6t0184.atlanta.hp.com ([15.193.32.61]:12114 "EHLO g6t0184.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932209Ab0BBTIT (ORCPT ); Tue, 2 Feb 2010 14:08:19 -0500 Received: from g5t0029.atlanta.hp.com (g5t0029.atlanta.hp.com [16.228.8.141]) by g6t0184.atlanta.hp.com (Postfix) with ESMTP id 6E744C708; Tue, 2 Feb 2010 19:08:19 +0000 (UTC) Received: from ldl (ldl.fc.hp.com [15.11.146.30]) by g5t0029.atlanta.hp.com (Postfix) with ESMTP id DB84620139; Tue, 2 Feb 2010 19:08:04 +0000 (UTC) Received: from localhost (ldl.fc.hp.com [127.0.0.1]) by ldl (Postfix) with ESMTP id B159ECF000A; Tue, 2 Feb 2010 12:08:04 -0700 (MST) Received: from ldl ([127.0.0.1]) by localhost (ldl.fc.hp.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TvbzVlqrYRaj; Tue, 2 Feb 2010 12:08:04 -0700 (MST) Received: from eh.fc.hp.com (eh.fc.hp.com [15.11.146.105]) by ldl (Postfix) with ESMTP id 9DFCFCF0007; Tue, 2 Feb 2010 12:08:04 -0700 (MST) Received: from bob.kio (localhost [127.0.0.1]) by eh.fc.hp.com (Postfix) with ESMTP id 84F1E261D3; Tue, 2 Feb 2010 12:08:04 -0700 (MST) Subject: [PATCH v2 04/18] IB/uverbs: use stack variable 'base' in ib_uverbs_add_one To: rdreier@cisco.com From: Alex Chiang Cc: linux-rdma@vger.kernel.org, justin.chen@hp.com, linux-kernel@vger.kernel.org Date: Tue, 02 Feb 2010 12:08:04 -0700 Message-ID: <20100202190804.28217.62413.stgit@bob.kio> In-Reply-To: <20100202185235.28217.64521.stgit@bob.kio> References: <20100202185235.28217.64521.stgit@bob.kio> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 02 Feb 2010 19:12:54 +0000 (UTC) diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index acae9ed..8c594cd 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c @@ -731,6 +731,7 @@ static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL); static void ib_uverbs_add_one(struct ib_device *device) { int devnum; + dev_t base; struct ib_uverbs_device *uverbs_dev; if (!device->alloc_ucontext) @@ -750,6 +751,7 @@ static void ib_uverbs_add_one(struct ib_device *device) goto err; } uverbs_dev->devnum = devnum; + base = devnum + IB_UVERBS_BASE_DEV; set_bit(devnum, dev_map); spin_unlock(&map_lock); @@ -760,7 +762,7 @@ static void ib_uverbs_add_one(struct ib_device *device) uverbs_dev->cdev.owner = THIS_MODULE; uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops; kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum); - if (cdev_add(&uverbs_dev->cdev, IB_UVERBS_BASE_DEV + devnum, 1)) + if (cdev_add(&uverbs_dev->cdev, base, 1)) goto err_cdev; uverbs_dev->dev = device_create(uverbs_class, device->dma_device,