Tyrel Datwyler <[email protected]> writes: > +static inline struct ibmvfc_host *ibmvfc_channels_to_vhost(struct > ibmvfc_channels *channels) > +{ > + if (channels->protocol == IBMVFC_PROTO_SCSI) > + return container_of(channels, struct ibmvfc_host, scsi_scrqs); > + else if (channels->protocol == IBMVFC_PROTO_NVME) > + return container_of(channels, struct ibmvfc_host, nvme_scrqs); > + > + return NULL; > +}
Nothing wrong with this, but in looking at the definition of container_of(), I see this: * WARNING: any const qualifier of @ptr is lost. * Do not use container_of() in new code. And there's now container_of_const(), where I see this: * Always prefer container_of_const() instead of container_of() in new code. -Dave
