public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
	devel@linuxdriverproject.org, virtualization@lists.osdl.org,
	Haiyang Zhang <haiyangz@microsoft.com>
Subject: Re: [PATCH 12/59] Staging: hv: vmbus: Cleanup vmbus_uevent() code
Date: Thu, 25 Aug 2011 13:59:30 -0700	[thread overview]
Message-ID: <20110825205930.GA10883@kroah.com> (raw)
In-Reply-To: <1314290965-2698-12-git-send-email-kys@microsoft.com>

On Thu, Aug 25, 2011 at 09:48:38AM -0700, K. Y. Srinivasan wrote:
> Now generate appropriate uevent based on the modalias string. As part of this,
> cleanup the existing uevent code.
> 
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> ---
>  drivers/staging/hv/vmbus_drv.c |   60 ++++++++--------------------------------
>  1 files changed, 12 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index b651968..a6e7dc5 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -237,58 +237,22 @@ static struct device_attribute vmbus_device_attrs[] = {
>   * This routine is invoked when a device is added or removed on the vmbus to
>   * generate a uevent to udev in the userspace. The udev will then look at its
>   * rule and the uevent generated here to load the appropriate driver
> + *
> + * The alias string will be of the form vmbus:guid where guid is the string
> + * representation of the device guid (each byte of the guid will be
> + * represented with two hex characters.
>   */
>  static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
>  {
>  	struct hv_device *dev = device_to_hv_device(device);
> -	int ret;
> -
> -	ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
> -			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
> -			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
> -			     dev->dev_type.b[3],
> -			     dev->dev_type.b[2],
> -			     dev->dev_type.b[1],
> -			     dev->dev_type.b[0],
> -			     dev->dev_type.b[5],
> -			     dev->dev_type.b[4],
> -			     dev->dev_type.b[7],
> -			     dev->dev_type.b[6],
> -			     dev->dev_type.b[8],
> -			     dev->dev_type.b[9],
> -			     dev->dev_type.b[10],
> -			     dev->dev_type.b[11],
> -			     dev->dev_type.b[12],
> -			     dev->dev_type.b[13],
> -			     dev->dev_type.b[14],
> -			     dev->dev_type.b[15]);
> -
> -	if (ret)
> -		return ret;
> +	int i, ret;
> +	char alias_name[((sizeof(struct hv_vmbus_device_id) + 1)) * 2];
>  
> -	ret = add_uevent_var(env, "VMBUS_DEVICE_DEVICE_GUID={"
> -			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
> -			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
> -			     dev->dev_instance.b[3],
> -			     dev->dev_instance.b[2],
> -			     dev->dev_instance.b[1],
> -			     dev->dev_instance.b[0],
> -			     dev->dev_instance.b[5],
> -			     dev->dev_instance.b[4],
> -			     dev->dev_instance.b[7],
> -			     dev->dev_instance.b[6],
> -			     dev->dev_instance.b[8],
> -			     dev->dev_instance.b[9],
> -			     dev->dev_instance.b[10],
> -			     dev->dev_instance.b[11],
> -			     dev->dev_instance.b[12],
> -			     dev->dev_instance.b[13],
> -			     dev->dev_instance.b[14],
> -			     dev->dev_instance.b[15]);
> -	if (ret)
> -		return ret;
> +	for (i = 0; i < (sizeof(struct hv_vmbus_device_id) * 2); i += 2)
> +		sprintf(&alias_name[i], "%02x", dev->dev_type.b[i/2]);

I have to edit this to get it to work properly with the fact that I
added the driver_data field to hv_vmbus_device_id.

Arguably, one could say that this patch was always broken as you were
assuming the size of an individual field was the same size as the whole
structure, which I don't think is always the case, or at least it's not
a safe thing to assume :)

thanks,

greg k-h

  reply	other threads:[~2011-08-25 21:08 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 16:47 [PATCH 0000/0059] Staging: hv: Driver cleanup K. Y. Srinivasan
2011-08-25 16:48 ` [PATCH 01/59] Staging: hv: vmbus: VMBUS is an ACPI enumerated device, get rid of the PCI signature K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 02/59] Staging: hv: Replace struct hv_guid with the uuid type already defined in Linux K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 03/59] Staging: hv: Add struct hv_vmbus_device_id to mod_devicetable.h K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 04/59] Staging: hv: Add code to parse struct hv_vmbus_device_id table K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 05/59] Staging: hv: vmbus: Introduce vmbus ID space in struct hv_driver K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 06/59] Staging: hv: blkvsc: Use the newly introduced vmbus ID in the blockvsc driver K. Y. Srinivasan
2011-08-25 17:36     ` Greg KH
2011-08-25 17:52       ` KY Srinivasan
2011-08-25 18:46         ` Greg KH
2011-08-25 18:50           ` KY Srinivasan
2011-08-25 20:43     ` Greg KH
2011-08-25 16:48   ` [PATCH 07/59] Staging: hv: storvsc: Use the newly introduced vmbus ID in storvsc driver K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 08/59] Staging: hv: netvsc: Use the newly introduced vmbus ID in netvsc driver K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 09/59] Staging: hv: mousevsc: Use the newly introduced vmbus ID in mouse driver K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 10/59] Staging: hv: util: Make hv_utils a vmbus device driver K. Y. Srinivasan
2011-08-30 15:53     ` Dan Carpenter
2011-08-30 17:14       ` KY Srinivasan
2011-08-25 16:48   ` [PATCH 11/59] Staging: hv: vmbus: Cleanup vmbus_match() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 12/59] Staging: hv: vmbus: Cleanup vmbus_uevent() code K. Y. Srinivasan
2011-08-25 20:59     ` Greg KH [this message]
2011-08-25 21:15       ` Greg KH
2011-08-25 22:20         ` KY Srinivasan
2011-08-25 22:28           ` Greg KH
2011-08-25 22:46             ` KY Srinivasan
2011-08-25 22:14       ` KY Srinivasan
2011-08-25 22:26         ` Greg KH
2011-08-25 16:48   ` [PATCH 13/59] Staging: hv: vmbus: Support the notion of id tables in vmbus_match() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 14/59] Staging: hv: vmbus: Get rid of an unnecessary include line in vmbus_drv.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 15/59] Staging: hv: storvsc: Get rid of the DMI signature K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 16/59] Staging: hv: netvsc: Get rid of the PCI signature K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 17/59] Staging: hv: netvsc: Get rid of the DMI signature in netvsc_drv.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 18/59] Staging: hv: util: Get rid of the DMI signature in hv_util.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 19/59] Staging: hv: util: Get rid of the PCI " K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 20/59] Staging: hv: netvsc: Initialize the driver name directly K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 21/59] Staging: hv: netvsc: Get rid of the empty function netvsc_initialize() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 22/59] Staging: hv: vmbus: Get rid of the unused name field in struct hv_driver K. Y. Srinivasan
2011-08-25 21:24     ` Greg KH
2011-08-25 21:28       ` Greg KH
2011-08-25 22:11         ` Greg KH
2011-08-25 22:27         ` KY Srinivasan
2011-08-25 22:35           ` Greg KH
2011-08-25 16:48   ` [PATCH 23/59] Staging: hv: vmbus: Get rid of some unnecessary comments K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 24/59] Staging: hv: vmbus: Cleanup unnecessary comments in hv.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 25/59] Staging: hv: vmbus: Cleanup error handling in hv_init() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 26/59] Staging: hv: vmbus: Get rid of unnecessay comments in connection.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 27/59] Staging: hv: vmbus: Get rid of the function dump_gpadl_body() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 28/59] Staging: hv: vmbus: Get rid of the function dump_gpadl_header() K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 29/59] Staging: hv: vmbus: Rename openMsg to open_msg in channel.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 30/59] Staging: hv: vmbus: Get rid of unnecessary comments " K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 31/59] Staging: hv: vmbus: Change the variable name openInfo to open_info " K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 32/59] Staging: hv: vmbus: Cleanup error values in ringbuffer.c K. Y. Srinivasan
2011-08-25 16:48   ` [PATCH 33/59] Staging: hv: vmbus: Cleanup the error return value in vmbus_recvpacket_raw() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 34/59] Staging: hv: netvsc: Get rid of an unnecessary print statement in netvsc_probe() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 35/59] Staging: hv: vmbus: Retry vmbus_post_msg() before giving up K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 36/59] Staging: hv: storvsc: Cleanup error handling in storvsc_dev_add() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 37/59] Staging: hv: storvsc: Cleanup error handling in storvsc_channel_init() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 38/59] Staging: hv: storvsc: Cleanup error handling in storvsc_connect_to_vsp() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 39/59] Staging: hv: storvsc: Cleanup error handling in storvsc_do_io() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 40/59] Storage: hv: storvsc: Get rid of some unnecessary DPRINTs from storvsc.c K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 41/59] Staging: hv: storvsc: Fix/cleanup some dated comments in storvsc.c K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 42/59] Staging: hv: storvsc: Cleanup returned error code in storvsc_host_reset() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 43/59] Staging: hv: storvsc: Cleanup error code returned in storvsc_probe() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 44/59] Staging: hv: storvsc: Cleanup returned error code in storvsc_drv_init() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 45/59] Staging: hv: netvsc: Cleanup the returned error code in netvsc_probe() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 46/59] Staging: hv: netvsc: Cleanup error return codes in netvsc_destroy_recv_buf() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 47/59] Staging: hv: netvsc: Cleanup error return values in netvsc_init_recv_buf() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 48/59] Staging: hv: netvsc: Cleanup error returns in netvsc_connect_vsp() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 49/59] Staging: hv: netvsc: Cleanup error return values in netvsc_send() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 50/59] Staging: hv: netvsc: Cleanup error return codes in netvsc_device_add() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 51/59] Staging: hv: netvsc: Cleanup error codes in rndis_filter_receive() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 52/59] Staging: hv: netvsc: Cleanup error code in rndis_filter_query_device() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 53/59] Staging: hv: netvsc: Cleanup error return values in rndis_filter_set_packet_filter() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 54/59] Staging: hv: netvsc: Cleanup error returns in rndis_filter_init_device() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 55/59] Staging: hv: netvsc: Cleanup error code in rndis_filter_device_add() K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 56/59] Staging: hv: mouse: Change the jump label Cleanup to cleanup K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 57/59] Staging: hv: mouse: Get rid of the unused PCI signature K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 58/59] Staging: hv: netvsc: Change the jump label Cleanup to cleanup K. Y. Srinivasan
2011-08-25 16:49   ` [PATCH 59/59] Staging: hv: netvsc: Change the jump label Exit to exit K. Y. Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110825205930.GA10883@kroah.com \
    --to=greg@kroah.com \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@suse.de \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox