Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1534432

Re: [PATCH 02/15] hyperv: Add a function to detect hv_device

From Greg KH <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH 02/15] hyperv: Add a function to detect hv_device
Date 2016-12-01 21:50 +0100
Message-ID <sJGj8-1KM-29@gated-at.bofh.it> (permalink)
References <sJBCN-5Lz-9@gated-at.bofh.it> <sJBCN-5Lz-11@gated-at.bofh.it> <sJBCO-5Lz-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 01, 2016 at 09:28:39AM -0800, kys@exchange.microsoft.com wrote:
> From: Haiyang Zhang <haiyangz@microsoft.com>
> 
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> ---
>  drivers/hv/vmbus_drv.c |    6 ++++++
>  include/linux/hyperv.h |    2 ++
>  2 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index 0276d2e..1730ac0 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -692,6 +692,12 @@ struct onmessage_work_context {
>  	struct hv_message msg;
>  };
>  
> +bool device_is_hyperv(struct device *dev)
> +{
> +	return dev->release == vmbus_device_release;
> +}
> +EXPORT_SYMBOL_GPL(device_is_hyperv);

Wait, eek, no!  That's NOT how you determine a device type, if you
really even ever need to do that.

Why are you needing this?  You should always "just know" what type of
device a struct device * is, that's what we rely on in the driver model.
Otherwise things get messy very very quickly.

Sorry, I can't take this without a ton of justification, and even then,
you need to do this correctly (and no, I'm not going to tell you how to
do that as I don't like it being done...)

greg k-h

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 02/15] hyperv: Add a function to detect hv_device kys@exchange.microsoft.com - 2016-12-01 16:40 +0100
  Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-01 21:40 +0100
    RE: [PATCH 02/15] hyperv: Add a function to detect hv_device KY Srinivasan <kys@microsoft.com> - 2016-12-02 06:50 +0100
  Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-01 21:40 +0100
  Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-01 21:50 +0100
    RE: [PATCH 02/15] hyperv: Add a function to detect hv_device KY Srinivasan <kys@microsoft.com> - 2016-12-02 07:10 +0100
      Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-02 07:50 +0100
        RE: [PATCH 02/15] hyperv: Add a function to detect hv_device KY Srinivasan <kys@microsoft.com> - 2016-12-02 08:20 +0100
          Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-02 08:40 +0100
            RE: [PATCH 02/15] hyperv: Add a function to detect hv_device KY Srinivasan <kys@microsoft.com> - 2016-12-02 16:50 +0100
              Re: [PATCH 02/15] hyperv: Add a function to detect hv_device Greg KH <gregkh@linuxfoundation.org> - 2016-12-02 17:10 +0100
                RE: [PATCH 02/15] hyperv: Add a function to detect hv_device KY Srinivasan <kys@microsoft.com> - 2016-12-02 22:50 +0100

csiph-web