Re: [PATCH 3/5] IB/core: Convert management helpers to core capability bits

ira.weiny
2015-05-12T22:06:51Z

On Tue, May 12, 2015 at 01:25:17PM -0600, Jason Gunthorpe wrote:
> On Mon, May 11, 2015 at 09:46:56PM -0400, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > From: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> >
> > Remove query_protocol callback
> >
> > Use the new Core Capability bits for:
>
> Looks broadly reasonable to me, I see why you'd want to keep the
> driver functions added in the last patch, so disregard my comment on
> null..
>
> > static inline bool rdma_protocol_ib(struct ib_device *device, u8 port_num)
> > {
> > - return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB;
> > + return (device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_PROT_IB)
> > + == RDMA_CORE_CAP_PROT_IB;
> > }
>
> This pattern can just be
>
> return device->port_immutable[port_num].core_cap_flags &
> RDMA_CORE_CAP_PROT_IB;
>
> Cast to bool will cannonize it automatically

I was not sure...

Done.

Thanks,
Ira