* [PATCH 1/4] hid-sensor-hub: fix style of comments @ 2013-08-14 8:07 Andy Shevchenko 2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko ` (4 more replies) 0 siblings, 5 replies; 12+ messages in thread From: Andy Shevchenko @ 2013-08-14 8:07 UTC (permalink / raw) To: Jiri Kosina, linux-input, Srinivas Pandruvada; +Cc: Andy Shevchenko This patch fixes the style of the comments to be like following /* The commentary */ There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/hid/hid-sensor-hub.c | 2 +- include/linux/hid-sensor-hub.h | 2 +- include/linux/hid-sensor-ids.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index ca749810..ffc80cf 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -416,7 +416,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, return 1; ptr = raw_data; - ptr++; /*Skip report id*/ + ptr++; /* Skip report id */ spin_lock_irqsave(&pdata->lock, flags); diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index ecefb73..32ba451 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -172,7 +172,7 @@ struct hid_sensor_common { struct hid_sensor_hub_attribute_info sensitivity; }; -/*Convert from hid unit expo to regular exponent*/ +/* Convert from hid unit expo to regular exponent */ static inline int hid_sensor_convert_exponent(int unit_expo) { if (unit_expo < 0x08) diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h index 6f24446..4f945d3 100644 --- a/include/linux/hid-sensor-ids.h +++ b/include/linux/hid-sensor-ids.h @@ -37,7 +37,7 @@ #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 -/*ORIENTATION: Compass 3D: (200083) */ +/* ORIENTATION: Compass 3D: (200083) */ #define HID_USAGE_SENSOR_COMPASS_3D 0x200083 #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 -- 1.8.4.rc2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] hid-sensor-hub: fix indentation accross the code 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko @ 2013-08-14 8:07 ` Andy Shevchenko 2013-08-19 15:28 ` Srinivas Pandruvada 2013-08-14 8:07 ` [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc Andy Shevchenko ` (3 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Andy Shevchenko @ 2013-08-14 8:07 UTC (permalink / raw) To: Jiri Kosina, linux-input, Srinivas Pandruvada; +Cc: Andy Shevchenko Patch just rearranges lines to be more compact and/or readable. Additionally it converts double space to one in several places. There is no functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/hid/hid-sensor-hub.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index ffc80cf..d0687d0 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -103,8 +103,7 @@ static int sensor_hub_get_physical_device_count( list_for_each_entry(report, &report_enum->report_list, list) { field = report->field[0]; - if (report->maxfield && field && - field->physical) + if (report->maxfield && field && field->physical) cnt++; } @@ -192,12 +191,12 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 value) { struct hid_report *report; - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); int ret = 0; mutex_lock(&data->mutex); report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); - if (!report || (field_index >= report->maxfield)) { + if (!report || (field_index >= report->maxfield)) { ret = -EINVAL; goto done_proc; } @@ -216,12 +215,12 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 *value) { struct hid_report *report; - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); int ret = 0; mutex_lock(&data->mutex); report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); - if (!report || (field_index >= report->maxfield)) { + if (!report || (field_index >= report->maxfield)) { ret = -EINVAL; goto done_proc; } @@ -241,7 +240,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, u32 usage_id, u32 attr_usage_id, u32 report_id) { - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); unsigned long flags; struct hid_report *report; int ret_val = 0; @@ -302,7 +301,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, /* Initialize with defaults */ info->usage_id = usage_id; - info->attrib_id = attr_usage_id; + info->attrib_id = attr_usage_id; info->report_id = -1; info->index = -1; info->units = -1; @@ -333,7 +332,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, if (field->usage[j].hid == attr_usage_id && field->usage[j].collection_index == - collection_index) { + collection_index) { sensor_hub_fill_attr_info(info, i, report->id, field->unit, @@ -357,7 +356,7 @@ EXPORT_SYMBOL_GPL(sensor_hub_input_get_attribute_info); #ifdef CONFIG_PM static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) { - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); struct hid_sensor_hub_callbacks_list *callback; hid_dbg(hdev, " sensor_hub_suspend\n"); @@ -374,7 +373,7 @@ static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) static int sensor_hub_resume(struct hid_device *hdev) { - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); struct hid_sensor_hub_callbacks_list *callback; hid_dbg(hdev, " sensor_hub_resume\n"); @@ -394,6 +393,7 @@ static int sensor_hub_reset_resume(struct hid_device *hdev) return 0; } #endif + /* * Handle raw report as sent by device */ @@ -421,7 +421,6 @@ static int sensor_hub_raw_event(struct hid_device *hdev, spin_lock_irqsave(&pdata->lock, flags); for (i = 0; i < report->maxfield; ++i) { - hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", i, report->field[i]->usage->collection_index, report->field[i]->usage->hid, @@ -434,7 +433,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); if (pdata->pending.raw_data) { memcpy(pdata->pending.raw_data, ptr, sz); - pdata->pending.raw_size = sz; + pdata->pending.raw_size = sz; } else pdata->pending.raw_size = 0; complete(&pdata->pending.ready); @@ -539,7 +538,7 @@ static int sensor_hub_probe(struct hid_device *hdev, field->physical) { name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x", field->physical); - if (name == NULL) { + if (name == NULL) { hid_err(hdev, "Failed MFD device name\n"); ret = -ENOMEM; goto err_free_names; @@ -617,8 +616,8 @@ static struct hid_driver sensor_hub_driver = { .raw_event = sensor_hub_raw_event, #ifdef CONFIG_PM .suspend = sensor_hub_suspend, - .resume = sensor_hub_resume, - .reset_resume = sensor_hub_reset_resume, + .resume = sensor_hub_resume, + .reset_resume = sensor_hub_reset_resume, #endif }; module_hid_driver(sensor_hub_driver); -- 1.8.4.rc2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] hid-sensor-hub: fix indentation accross the code 2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko @ 2013-08-19 15:28 ` Srinivas Pandruvada 2013-08-29 14:53 ` Andy Shevchenko 0 siblings, 1 reply; 12+ messages in thread From: Srinivas Pandruvada @ 2013-08-19 15:28 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Jiri Kosina, linux-input, Srinivas Pandruvada On 08/14/2013 01:07 AM, Andy Shevchenko wrote: > Patch just rearranges lines to be more compact and/or readable. Additionally it > converts double space to one in several places. > > There is no functional change. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/hid/hid-sensor-hub.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > index ffc80cf..d0687d0 100644 > --- a/drivers/hid/hid-sensor-hub.c > +++ b/drivers/hid/hid-sensor-hub.c > @@ -103,8 +103,7 @@ static int sensor_hub_get_physical_device_count( > > list_for_each_entry(report, &report_enum->report_list, list) { > field = report->field[0]; > - if (report->maxfield && field && > - field->physical) > + if (report->maxfield && field && field->physical) > cnt++; > } > > @@ -192,12 +191,12 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, > u32 field_index, s32 value) > { > struct hid_report *report; > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > int ret = 0; > > mutex_lock(&data->mutex); > report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); > - if (!report || (field_index >= report->maxfield)) { > + if (!report || (field_index >= report->maxfield)) { > ret = -EINVAL; > goto done_proc; > } > @@ -216,12 +215,12 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, > u32 field_index, s32 *value) > { > struct hid_report *report; > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > int ret = 0; > > mutex_lock(&data->mutex); > report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); > - if (!report || (field_index >= report->maxfield)) { > + if (!report || (field_index >= report->maxfield)) { > ret = -EINVAL; > goto done_proc; > } > @@ -241,7 +240,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, > u32 usage_id, > u32 attr_usage_id, u32 report_id) > { > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > unsigned long flags; > struct hid_report *report; > int ret_val = 0; > @@ -302,7 +301,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, > > /* Initialize with defaults */ > info->usage_id = usage_id; > - info->attrib_id = attr_usage_id; > + info->attrib_id = attr_usage_id; > info->report_id = -1; > info->index = -1; > info->units = -1; > @@ -333,7 +332,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, > if (field->usage[j].hid == > attr_usage_id && > field->usage[j].collection_index == > - collection_index) { > + collection_index) { > sensor_hub_fill_attr_info(info, > i, report->id, > field->unit, > @@ -357,7 +356,7 @@ EXPORT_SYMBOL_GPL(sensor_hub_input_get_attribute_info); > #ifdef CONFIG_PM > static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) > { > - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > struct hid_sensor_hub_callbacks_list *callback; > > hid_dbg(hdev, " sensor_hub_suspend\n"); > @@ -374,7 +373,7 @@ static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) > > static int sensor_hub_resume(struct hid_device *hdev) > { > - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > struct hid_sensor_hub_callbacks_list *callback; > > hid_dbg(hdev, " sensor_hub_resume\n"); > @@ -394,6 +393,7 @@ static int sensor_hub_reset_resume(struct hid_device *hdev) > return 0; > } > #endif > + > /* > * Handle raw report as sent by device > */ > @@ -421,7 +421,6 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > spin_lock_irqsave(&pdata->lock, flags); > > for (i = 0; i < report->maxfield; ++i) { > - > hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", > i, report->field[i]->usage->collection_index, > report->field[i]->usage->hid, > @@ -434,7 +433,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); > if (pdata->pending.raw_data) { > memcpy(pdata->pending.raw_data, ptr, sz); > - pdata->pending.raw_size = sz; > + pdata->pending.raw_size = sz; > } else > pdata->pending.raw_size = 0; > complete(&pdata->pending.ready); > @@ -539,7 +538,7 @@ static int sensor_hub_probe(struct hid_device *hdev, > field->physical) { > name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x", > field->physical); > - if (name == NULL) { > + if (name == NULL) { > hid_err(hdev, "Failed MFD device name\n"); > ret = -ENOMEM; > goto err_free_names; > @@ -617,8 +616,8 @@ static struct hid_driver sensor_hub_driver = { > .raw_event = sensor_hub_raw_event, > #ifdef CONFIG_PM > .suspend = sensor_hub_suspend, > - .resume = sensor_hub_resume, > - .reset_resume = sensor_hub_reset_resume, > + .resume = sensor_hub_resume, > + .reset_resume = sensor_hub_reset_resume, > #endif > }; > module_hid_driver(sensor_hub_driver); Agreed. Thanks, Srinivas ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] hid-sensor-hub: fix indentation accross the code 2013-08-19 15:28 ` Srinivas Pandruvada @ 2013-08-29 14:53 ` Andy Shevchenko 2013-09-04 10:21 ` Jiri Kosina 0 siblings, 1 reply; 12+ messages in thread From: Andy Shevchenko @ 2013-08-29 14:53 UTC (permalink / raw) To: Srinivas Pandruvada; +Cc: Jiri Kosina, linux-input, Srinivas Pandruvada On Mon, 2013-08-19 at 08:28 -0700, Srinivas Pandruvada wrote: > On 08/14/2013 01:07 AM, Andy Shevchenko wrote: > > Patch just rearranges lines to be more compact and/or readable. Additionally it > > converts double space to one in several places. > > > > There is no functional change. Jiri, anything about this patch and the rest of the series? It seems you applied only patch 1/4. Do you have comments? > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > drivers/hid/hid-sensor-hub.c | 31 +++++++++++++++---------------- > > 1 file changed, 15 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > > index ffc80cf..d0687d0 100644 > > --- a/drivers/hid/hid-sensor-hub.c > > +++ b/drivers/hid/hid-sensor-hub.c > > @@ -103,8 +103,7 @@ static int sensor_hub_get_physical_device_count( > > > > list_for_each_entry(report, &report_enum->report_list, list) { > > field = report->field[0]; > > - if (report->maxfield && field && > > - field->physical) > > + if (report->maxfield && field && field->physical) > > cnt++; > > } > > > > @@ -192,12 +191,12 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, > > u32 field_index, s32 value) > > { > > struct hid_report *report; > > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > int ret = 0; > > > > mutex_lock(&data->mutex); > > report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); > > - if (!report || (field_index >= report->maxfield)) { > > + if (!report || (field_index >= report->maxfield)) { > > ret = -EINVAL; > > goto done_proc; > > } > > @@ -216,12 +215,12 @@ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, > > u32 field_index, s32 *value) > > { > > struct hid_report *report; > > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > int ret = 0; > > > > mutex_lock(&data->mutex); > > report = sensor_hub_report(report_id, hsdev->hdev, HID_FEATURE_REPORT); > > - if (!report || (field_index >= report->maxfield)) { > > + if (!report || (field_index >= report->maxfield)) { > > ret = -EINVAL; > > goto done_proc; > > } > > @@ -241,7 +240,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, > > u32 usage_id, > > u32 attr_usage_id, u32 report_id) > > { > > - struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > + struct sensor_hub_data *data = hid_get_drvdata(hsdev->hdev); > > unsigned long flags; > > struct hid_report *report; > > int ret_val = 0; > > @@ -302,7 +301,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, > > > > /* Initialize with defaults */ > > info->usage_id = usage_id; > > - info->attrib_id = attr_usage_id; > > + info->attrib_id = attr_usage_id; > > info->report_id = -1; > > info->index = -1; > > info->units = -1; > > @@ -333,7 +332,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, > > if (field->usage[j].hid == > > attr_usage_id && > > field->usage[j].collection_index == > > - collection_index) { > > + collection_index) { > > sensor_hub_fill_attr_info(info, > > i, report->id, > > field->unit, > > @@ -357,7 +356,7 @@ EXPORT_SYMBOL_GPL(sensor_hub_input_get_attribute_info); > > #ifdef CONFIG_PM > > static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) > > { > > - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > > + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > > struct hid_sensor_hub_callbacks_list *callback; > > > > hid_dbg(hdev, " sensor_hub_suspend\n"); > > @@ -374,7 +373,7 @@ static int sensor_hub_suspend(struct hid_device *hdev, pm_message_t message) > > > > static int sensor_hub_resume(struct hid_device *hdev) > > { > > - struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > > + struct sensor_hub_data *pdata = hid_get_drvdata(hdev); > > struct hid_sensor_hub_callbacks_list *callback; > > > > hid_dbg(hdev, " sensor_hub_resume\n"); > > @@ -394,6 +393,7 @@ static int sensor_hub_reset_resume(struct hid_device *hdev) > > return 0; > > } > > #endif > > + > > /* > > * Handle raw report as sent by device > > */ > > @@ -421,7 +421,6 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > > spin_lock_irqsave(&pdata->lock, flags); > > > > for (i = 0; i < report->maxfield; ++i) { > > - > > hid_dbg(hdev, "%d collection_index:%x hid:%x sz:%x\n", > > i, report->field[i]->usage->collection_index, > > report->field[i]->usage->hid, > > @@ -434,7 +433,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > > pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); > > if (pdata->pending.raw_data) { > > memcpy(pdata->pending.raw_data, ptr, sz); > > - pdata->pending.raw_size = sz; > > + pdata->pending.raw_size = sz; > > } else > > pdata->pending.raw_size = 0; > > complete(&pdata->pending.ready); > > @@ -539,7 +538,7 @@ static int sensor_hub_probe(struct hid_device *hdev, > > field->physical) { > > name = kasprintf(GFP_KERNEL, "HID-SENSOR-%x", > > field->physical); > > - if (name == NULL) { > > + if (name == NULL) { > > hid_err(hdev, "Failed MFD device name\n"); > > ret = -ENOMEM; > > goto err_free_names; > > @@ -617,8 +616,8 @@ static struct hid_driver sensor_hub_driver = { > > .raw_event = sensor_hub_raw_event, > > #ifdef CONFIG_PM > > .suspend = sensor_hub_suspend, > > - .resume = sensor_hub_resume, > > - .reset_resume = sensor_hub_reset_resume, > > + .resume = sensor_hub_resume, > > + .reset_resume = sensor_hub_reset_resume, > > #endif > > }; > > module_hid_driver(sensor_hub_driver); > Agreed. > > Thanks, > Srinivas -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] hid-sensor-hub: fix indentation accross the code 2013-08-29 14:53 ` Andy Shevchenko @ 2013-09-04 10:21 ` Jiri Kosina 0 siblings, 0 replies; 12+ messages in thread From: Jiri Kosina @ 2013-09-04 10:21 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Srinivas Pandruvada, linux-input, Srinivas Pandruvada On Thu, 29 Aug 2013, Andy Shevchenko wrote: > On Mon, 2013-08-19 at 08:28 -0700, Srinivas Pandruvada wrote: > > On 08/14/2013 01:07 AM, Andy Shevchenko wrote: > > > Patch just rearranges lines to be more compact and/or readable. Additionally it > > > converts double space to one in several places. > > > > > > There is no functional change. > > Jiri, anything about this patch and the rest of the series? > It seems you applied only patch 1/4. Do you have comments? The whole series is now applied. -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko 2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko @ 2013-08-14 8:07 ` Andy Shevchenko 2013-08-19 15:31 ` Srinivas Pandruvada 2013-08-14 8:07 ` [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup Andy Shevchenko ` (2 subsequent siblings) 4 siblings, 1 reply; 12+ messages in thread From: Andy Shevchenko @ 2013-08-14 8:07 UTC (permalink / raw) To: Jiri Kosina, linux-input, Srinivas Pandruvada; +Cc: Andy Shevchenko devm_kzalloc() will manage resources freeing and allows to make error path smaller and nicer. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/hid/hid-sensor-hub.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index d0687d0..4cb19df 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -477,16 +477,15 @@ static int sensor_hub_probe(struct hid_device *hdev, struct hid_field *field; int dev_cnt; - sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL); + sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); if (!sd) { hid_err(hdev, "cannot allocate Sensor data\n"); return -ENOMEM; } - sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL); + sd->hsdev = devm_kzalloc(&hdev->dev, sizeof(*sd->hsdev), GFP_KERNEL); if (!sd->hsdev) { hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); - ret = -ENOMEM; - goto err_free_hub; + return -ENOMEM; } hid_set_drvdata(hdev, sd); sd->hsdev->hdev = hdev; @@ -498,14 +497,14 @@ static int sensor_hub_probe(struct hid_device *hdev, ret = hid_parse(hdev); if (ret) { hid_err(hdev, "parse failed\n"); - goto err_free; + return ret; } INIT_LIST_HEAD(&hdev->inputs); ret = hid_hw_start(hdev, 0); if (ret) { hid_err(hdev, "hw start failed\n"); - goto err_free; + return ret; } ret = hid_hw_open(hdev); if (ret) { @@ -570,10 +569,6 @@ err_close: hid_hw_close(hdev); err_stop_hw: hid_hw_stop(hdev); -err_free: - kfree(sd->hsdev); -err_free_hub: - kfree(sd); return ret; } @@ -597,8 +592,6 @@ static void sensor_hub_remove(struct hid_device *hdev) kfree(data->hid_sensor_hub_client_devs); hid_set_drvdata(hdev, NULL); mutex_destroy(&data->mutex); - kfree(data->hsdev); - kfree(data); } static const struct hid_device_id sensor_hub_devices[] = { -- 1.8.4.rc2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc 2013-08-14 8:07 ` [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc Andy Shevchenko @ 2013-08-19 15:31 ` Srinivas Pandruvada 0 siblings, 0 replies; 12+ messages in thread From: Srinivas Pandruvada @ 2013-08-19 15:31 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Jiri Kosina, linux-input, Srinivas Pandruvada On 08/14/2013 01:07 AM, Andy Shevchenko wrote: > devm_kzalloc() will manage resources freeing and allows to make error path > smaller and nicer. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/hid/hid-sensor-hub.c | 17 +++++------------ > 1 file changed, 5 insertions(+), 12 deletions(-) > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > index d0687d0..4cb19df 100644 > --- a/drivers/hid/hid-sensor-hub.c > +++ b/drivers/hid/hid-sensor-hub.c > @@ -477,16 +477,15 @@ static int sensor_hub_probe(struct hid_device *hdev, > struct hid_field *field; > int dev_cnt; > > - sd = kzalloc(sizeof(struct sensor_hub_data), GFP_KERNEL); > + sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL); > if (!sd) { > hid_err(hdev, "cannot allocate Sensor data\n"); > return -ENOMEM; > } > - sd->hsdev = kzalloc(sizeof(struct hid_sensor_hub_device), GFP_KERNEL); > + sd->hsdev = devm_kzalloc(&hdev->dev, sizeof(*sd->hsdev), GFP_KERNEL); > if (!sd->hsdev) { > hid_err(hdev, "cannot allocate hid_sensor_hub_device\n"); > - ret = -ENOMEM; > - goto err_free_hub; > + return -ENOMEM; > } > hid_set_drvdata(hdev, sd); > sd->hsdev->hdev = hdev; > @@ -498,14 +497,14 @@ static int sensor_hub_probe(struct hid_device *hdev, > ret = hid_parse(hdev); > if (ret) { > hid_err(hdev, "parse failed\n"); > - goto err_free; > + return ret; > } > INIT_LIST_HEAD(&hdev->inputs); > > ret = hid_hw_start(hdev, 0); > if (ret) { > hid_err(hdev, "hw start failed\n"); > - goto err_free; > + return ret; > } > ret = hid_hw_open(hdev); > if (ret) { > @@ -570,10 +569,6 @@ err_close: > hid_hw_close(hdev); > err_stop_hw: > hid_hw_stop(hdev); > -err_free: > - kfree(sd->hsdev); > -err_free_hub: > - kfree(sd); > > return ret; > } > @@ -597,8 +592,6 @@ static void sensor_hub_remove(struct hid_device *hdev) > kfree(data->hid_sensor_hub_client_devs); > hid_set_drvdata(hdev, NULL); > mutex_destroy(&data->mutex); > - kfree(data->hsdev); > - kfree(data); > } > > static const struct hid_device_id sensor_hub_devices[] = { Agreed. Thanks, Srinivas ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko 2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko 2013-08-14 8:07 ` [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc Andy Shevchenko @ 2013-08-14 8:07 ` Andy Shevchenko 2013-08-19 15:32 ` Srinivas Pandruvada 2013-08-19 8:48 ` [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko 2013-08-26 11:46 ` Jiri Kosina 4 siblings, 1 reply; 12+ messages in thread From: Andy Shevchenko @ 2013-08-14 8:07 UTC (permalink / raw) To: Jiri Kosina, linux-input, Srinivas Pandruvada; +Cc: Andy Shevchenko The patch substitutes kmemdup for kmalloc followed by memcpy. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/hid/hid-sensor-hub.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 4cb19df..0794e9f 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -430,11 +430,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, if (pdata->pending.status && pdata->pending.attr_usage_id == report->field[i]->usage->hid) { hid_dbg(hdev, "data was pending ...\n"); - pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); - if (pdata->pending.raw_data) { - memcpy(pdata->pending.raw_data, ptr, sz); + pdata->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC); + if (pdata->pending.raw_data) pdata->pending.raw_size = sz; - } else + else pdata->pending.raw_size = 0; complete(&pdata->pending.ready); } -- 1.8.4.rc2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup 2013-08-14 8:07 ` [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup Andy Shevchenko @ 2013-08-19 15:32 ` Srinivas Pandruvada 0 siblings, 0 replies; 12+ messages in thread From: Srinivas Pandruvada @ 2013-08-19 15:32 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Jiri Kosina, linux-input, Srinivas Pandruvada On 08/14/2013 01:07 AM, Andy Shevchenko wrote: > The patch substitutes kmemdup for kmalloc followed by memcpy. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/hid/hid-sensor-hub.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > index 4cb19df..0794e9f 100644 > --- a/drivers/hid/hid-sensor-hub.c > +++ b/drivers/hid/hid-sensor-hub.c > @@ -430,11 +430,10 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > if (pdata->pending.status && pdata->pending.attr_usage_id == > report->field[i]->usage->hid) { > hid_dbg(hdev, "data was pending ...\n"); > - pdata->pending.raw_data = kmalloc(sz, GFP_ATOMIC); > - if (pdata->pending.raw_data) { > - memcpy(pdata->pending.raw_data, ptr, sz); > + pdata->pending.raw_data = kmemdup(ptr, sz, GFP_ATOMIC); > + if (pdata->pending.raw_data) > pdata->pending.raw_size = sz; > - } else > + else > pdata->pending.raw_size = 0; > complete(&pdata->pending.ready); > } Agreed. Thanks, Srinivas ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] hid-sensor-hub: fix style of comments 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko ` (2 preceding siblings ...) 2013-08-14 8:07 ` [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup Andy Shevchenko @ 2013-08-19 8:48 ` Andy Shevchenko 2013-08-19 15:26 ` Srinivas Pandruvada 2013-08-26 11:46 ` Jiri Kosina 4 siblings, 1 reply; 12+ messages in thread From: Andy Shevchenko @ 2013-08-19 8:48 UTC (permalink / raw) To: Jiri Kosina; +Cc: linux-input, Srinivas Pandruvada On Wed, 2013-08-14 at 11:07 +0300, Andy Shevchenko wrote: > This patch fixes the style of the comments to be like following > /* The commentary */ > > There is no functional change. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Jiri, Srinivas, any comments on this? > --- > drivers/hid/hid-sensor-hub.c | 2 +- > include/linux/hid-sensor-hub.h | 2 +- > include/linux/hid-sensor-ids.h | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > index ca749810..ffc80cf 100644 > --- a/drivers/hid/hid-sensor-hub.c > +++ b/drivers/hid/hid-sensor-hub.c > @@ -416,7 +416,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > return 1; > > ptr = raw_data; > - ptr++; /*Skip report id*/ > + ptr++; /* Skip report id */ > > spin_lock_irqsave(&pdata->lock, flags); > > diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h > index ecefb73..32ba451 100644 > --- a/include/linux/hid-sensor-hub.h > +++ b/include/linux/hid-sensor-hub.h > @@ -172,7 +172,7 @@ struct hid_sensor_common { > struct hid_sensor_hub_attribute_info sensitivity; > }; > > -/*Convert from hid unit expo to regular exponent*/ > +/* Convert from hid unit expo to regular exponent */ > static inline int hid_sensor_convert_exponent(int unit_expo) > { > if (unit_expo < 0x08) > diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h > index 6f24446..4f945d3 100644 > --- a/include/linux/hid-sensor-ids.h > +++ b/include/linux/hid-sensor-ids.h > @@ -37,7 +37,7 @@ > #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 > #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 > > -/*ORIENTATION: Compass 3D: (200083) */ > +/* ORIENTATION: Compass 3D: (200083) */ > #define HID_USAGE_SENSOR_COMPASS_3D 0x200083 > #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 > #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 -- Andy Shevchenko <andriy.shevchenko@linux.intel.com> Intel Finland Oy ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] hid-sensor-hub: fix style of comments 2013-08-19 8:48 ` [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko @ 2013-08-19 15:26 ` Srinivas Pandruvada 0 siblings, 0 replies; 12+ messages in thread From: Srinivas Pandruvada @ 2013-08-19 15:26 UTC (permalink / raw) To: Andy Shevchenko; +Cc: Jiri Kosina, linux-input, Srinivas Pandruvada On 08/19/2013 01:48 AM, Andy Shevchenko wrote: > On Wed, 2013-08-14 at 11:07 +0300, Andy Shevchenko wrote: >> This patch fixes the style of the comments to be like following >> /* The commentary */ >> >> There is no functional change. >> >> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Jiri, Srinivas, any comments on this? Agreed. >> --- >> drivers/hid/hid-sensor-hub.c | 2 +- >> include/linux/hid-sensor-hub.h | 2 +- >> include/linux/hid-sensor-ids.h | 2 +- >> 3 files changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c >> index ca749810..ffc80cf 100644 >> --- a/drivers/hid/hid-sensor-hub.c >> +++ b/drivers/hid/hid-sensor-hub.c >> @@ -416,7 +416,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, >> return 1; >> >> ptr = raw_data; >> - ptr++; /*Skip report id*/ >> + ptr++; /* Skip report id */ >> >> spin_lock_irqsave(&pdata->lock, flags); >> >> diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h >> index ecefb73..32ba451 100644 >> --- a/include/linux/hid-sensor-hub.h >> +++ b/include/linux/hid-sensor-hub.h >> @@ -172,7 +172,7 @@ struct hid_sensor_common { >> struct hid_sensor_hub_attribute_info sensitivity; >> }; >> >> -/*Convert from hid unit expo to regular exponent*/ >> +/* Convert from hid unit expo to regular exponent */ >> static inline int hid_sensor_convert_exponent(int unit_expo) >> { >> if (unit_expo < 0x08) >> diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h >> index 6f24446..4f945d3 100644 >> --- a/include/linux/hid-sensor-ids.h >> +++ b/include/linux/hid-sensor-ids.h >> @@ -37,7 +37,7 @@ >> #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 >> #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 >> >> -/*ORIENTATION: Compass 3D: (200083) */ >> +/* ORIENTATION: Compass 3D: (200083) */ >> #define HID_USAGE_SENSOR_COMPASS_3D 0x200083 >> #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 >> #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 Thanks, Srinivas ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] hid-sensor-hub: fix style of comments 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko ` (3 preceding siblings ...) 2013-08-19 8:48 ` [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko @ 2013-08-26 11:46 ` Jiri Kosina 4 siblings, 0 replies; 12+ messages in thread From: Jiri Kosina @ 2013-08-26 11:46 UTC (permalink / raw) To: Andy Shevchenko; +Cc: linux-input, Srinivas Pandruvada On Wed, 14 Aug 2013, Andy Shevchenko wrote: > This patch fixes the style of the comments to be like following > /* The commentary */ > > There is no functional change. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Applied. > --- > drivers/hid/hid-sensor-hub.c | 2 +- > include/linux/hid-sensor-hub.h | 2 +- > include/linux/hid-sensor-ids.h | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c > index ca749810..ffc80cf 100644 > --- a/drivers/hid/hid-sensor-hub.c > +++ b/drivers/hid/hid-sensor-hub.c > @@ -416,7 +416,7 @@ static int sensor_hub_raw_event(struct hid_device *hdev, > return 1; > > ptr = raw_data; > - ptr++; /*Skip report id*/ > + ptr++; /* Skip report id */ > > spin_lock_irqsave(&pdata->lock, flags); > > diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h > index ecefb73..32ba451 100644 > --- a/include/linux/hid-sensor-hub.h > +++ b/include/linux/hid-sensor-hub.h > @@ -172,7 +172,7 @@ struct hid_sensor_common { > struct hid_sensor_hub_attribute_info sensitivity; > }; > > -/*Convert from hid unit expo to regular exponent*/ > +/* Convert from hid unit expo to regular exponent */ > static inline int hid_sensor_convert_exponent(int unit_expo) > { > if (unit_expo < 0x08) > diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h > index 6f24446..4f945d3 100644 > --- a/include/linux/hid-sensor-ids.h > +++ b/include/linux/hid-sensor-ids.h > @@ -37,7 +37,7 @@ > #define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 > #define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 > > -/*ORIENTATION: Compass 3D: (200083) */ > +/* ORIENTATION: Compass 3D: (200083) */ > #define HID_USAGE_SENSOR_COMPASS_3D 0x200083 > #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 > #define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 > -- > 1.8.4.rc2 > -- Jiri Kosina SUSE Labs ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-09-04 10:21 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-14 8:07 [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko 2013-08-14 8:07 ` [PATCH 2/4] hid-sensor-hub: fix indentation accross the code Andy Shevchenko 2013-08-19 15:28 ` Srinivas Pandruvada 2013-08-29 14:53 ` Andy Shevchenko 2013-09-04 10:21 ` Jiri Kosina 2013-08-14 8:07 ` [PATCH 3/4] hid-sensor-hub: move to devm_kzalloc Andy Shevchenko 2013-08-19 15:31 ` Srinivas Pandruvada 2013-08-14 8:07 ` [PATCH 4/4] hid-sensor-hub: change kmalloc + memcpy by kmemdup Andy Shevchenko 2013-08-19 15:32 ` Srinivas Pandruvada 2013-08-19 8:48 ` [PATCH 1/4] hid-sensor-hub: fix style of comments Andy Shevchenko 2013-08-19 15:26 ` Srinivas Pandruvada 2013-08-26 11:46 ` Jiri Kosina
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).