[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL1RGDVv6y-EOiNv-Vmd+jN1dnSPvA0YK_kamYZwmgUzRmUx=g@mail.gmail.com>
Date: Wed, 21 Mar 2012 09:42:37 -0700
From: Roland Dreier <roland@...estorage.com>
To: parav.pandit@...lex.com
Cc: linux-rdma@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 6/9] ocrdma: Driver for Emulex OneConnect RDMA adapter
> +struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev,
> + struct ib_ucontext *context,
> + struct ib_udata *udata)
> +{
> + struct ocrdma_dev *dev = get_ocrdma_dev(ibdev);
> + struct ocrdma_pd *pd;
> + int status;
> +
> + pd = kzalloc(sizeof(*pd), GFP_KERNEL);
> + if (!pd)
> + return ERR_PTR(-ENOMEM);
> + pd->dev = dev;
> + if (udata && context) {
> + pd->dpp_enabled = (dev->nic_info.dev_family ==
> + OCRDMA_GEN2_FAMILY) ? true : false;
Writing
(<bool expr>) ? true : false
is pretty silly, since it's just an obfuscated way of writing
<bool expr>
IOW, you can just write
pd->dpp_enabled = (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY);
> +int ocrdma_dealloc_pd(struct ib_pd *ibpd)
> +{
> + struct ocrdma_pd *pd = get_ocrdma_pd(ibpd);
> + struct ocrdma_dev *dev = pd->dev;
> + int status;
> + u64 usr_db;
> +
> + if (atomic_read(&pd->use_cnt)) {
> + ocrdma_err("%s(%d) pd=0x%x is in use.\n",
> + __func__, dev->id, pd->id);
> + status = -EFAULT;
> + goto dealloc_err;
> + }
all of the use_cnt tracking in this driver seems to duplicate what the rdma
midlayer already does... is there any reason we need that in the low-level
hardware driver too, or can we just get rid of the various use_cnt members?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists