* [PATCH v3 0/6] Staging: rts5139: Fix coding style
@ 2014-04-22 21:22 Fabio Falzoi
2014-04-22 21:22 ` [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced Fabio Falzoi
` (5 more replies)
0 siblings, 6 replies; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Fix some coding style issues in rts51x.c (from rts5139 module).
Changes in v3:
* removed all the Out Of Memory messages
* redefined pr_fmt to add a prefix to each pr_<level>.
Changes in v2:
* patch splitted to have just one specific coding style issue fixed at a time
Fabio Falzoi (6):
Staging: rts5139: Camel case labels replaced
Staging: rts5139: Fixed multi-line code alignment
Staging: rts5139: Splitted one-line multiple assignment
Staging: rts5139: Use standard pr_<level> prefixing
Staging: rts5139: Removed OOM messages
Staging: rts5139: More appropriate use of sizeof operand
drivers/staging/rts5139/rts51x.c | 125 ++++++++++++++++++---------------------
1 file changed, 57 insertions(+), 68 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
@ 2014-04-22 21:22 ` Fabio Falzoi
2014-04-22 22:03 ` Dan Carpenter
2014-04-22 21:23 ` [PATCH v3 2/6] Staging: rts5139: Fixed multi-line code alignment Fabio Falzoi
` (4 subsequent siblings)
5 siblings, 1 reply; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:22 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Replace camel case labels with linux coding style compliant names.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index c8d06d4..9d9c706 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -273,7 +273,7 @@ static int rts51x_control_thread(void *__chip)
/* has the command timed out *already* ? */
if (test_bit(FLIDX_TIMED_OUT, &chip->usb->dflags)) {
chip->srb->result = DID_ABORT << 16;
- goto SkipForAbort;
+ goto abort;
}
scsi_unlock(host);
@@ -316,7 +316,7 @@ static int rts51x_control_thread(void *__chip)
if (chip->srb->result != DID_ABORT << 16)
chip->srb->scsi_done(chip->srb);
else
-SkipForAbort :
+abort :
RTS51X_DEBUGP("scsi command aborted\n");
/* If an abort request was received we need to signal that
@@ -763,17 +763,17 @@ static int rts51x_probe(struct usb_interface *intf,
/* Associate the us_data structure with the USB device */
result = associate_dev(chip, intf);
if (result)
- goto BadDevice;
+ goto bad_device;
/* Find the endpoints and calculate pipe values */
result = get_pipes(chip);
if (result)
- goto BadDevice;
+ goto bad_device;
/* Acquire all the other resources and add the host */
result = rts51x_acquire_resources(chip);
if (result)
- goto BadDevice;
+ goto bad_device;
/* Start up our control thread */
th = kthread_run(rts51x_control_thread, chip, RTS51X_CTL_THREAD);
@@ -781,14 +781,14 @@ static int rts51x_probe(struct usb_interface *intf,
printk(KERN_WARNING RTS51X_TIP
"Unable to start control thread\n");
result = PTR_ERR(th);
- goto BadDevice;
+ goto bad_device;
}
rts51x->ctl_thread = th;
result = scsi_add_host(rts51x_to_host(chip), &rts51x->pusb_intf->dev);
if (result) {
printk(KERN_WARNING RTS51X_TIP "Unable to add the scsi host\n");
- goto BadDevice;
+ goto bad_device;
}
scsi_scan_host(rts51x_to_host(chip));
@@ -798,7 +798,7 @@ static int rts51x_probe(struct usb_interface *intf,
printk(KERN_WARNING RTS51X_TIP
"Unable to start polling thread\n");
result = PTR_ERR(th);
- goto BadDevice;
+ goto bad_device;
}
rts51x->polling_thread = th;
@@ -813,7 +813,7 @@ static int rts51x_probe(struct usb_interface *intf,
return 0;
/* We come here if there are any problems */
-BadDevice:
+bad_device:
RTS51X_DEBUGP("rts51x_probe() failed\n");
release_everything(chip);
return result;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 2/6] Staging: rts5139: Fixed multi-line code alignment
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
2014-04-22 21:22 ` [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced Fabio Falzoi
@ 2014-04-22 21:23 ` Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 3/6] Staging: rts5139: Splitted one-line multiple assignment Fabio Falzoi
` (3 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:23 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Multi-line code aligned with open parenthesis.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 9d9c706..28f4631 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -291,15 +291,15 @@ static int rts51x_control_thread(void *__chip)
*/
else if (chip->srb->device->id) {
RTS51X_DEBUGP("Bad target number (%d:%d)\n",
- chip->srb->device->id,
- chip->srb->device->lun);
+ chip->srb->device->id,
+ chip->srb->device->lun);
chip->srb->result = DID_BAD_TARGET << 16;
}
else if (chip->srb->device->lun > chip->max_lun) {
RTS51X_DEBUGP("Bad LUN (%d:%d)\n",
- chip->srb->device->id,
- chip->srb->device->lun);
+ chip->srb->device->id,
+ chip->srb->device->lun);
chip->srb->result = DID_BAD_TARGET << 16;
}
@@ -433,12 +433,12 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->pusb_intf = intf;
rts51x->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
RTS51X_DEBUGP("Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n",
- le16_to_cpu(rts51x->pusb_dev->descriptor.idVendor),
- le16_to_cpu(rts51x->pusb_dev->descriptor.idProduct),
- le16_to_cpu(rts51x->pusb_dev->descriptor.bcdDevice));
+ le16_to_cpu(rts51x->pusb_dev->descriptor.idVendor),
+ le16_to_cpu(rts51x->pusb_dev->descriptor.idProduct),
+ le16_to_cpu(rts51x->pusb_dev->descriptor.bcdDevice));
RTS51X_DEBUGP("Interface Subclass: 0x%02x, Protocol: 0x%02x\n",
- intf->cur_altsetting->desc.bInterfaceSubClass,
- intf->cur_altsetting->desc.bInterfaceProtocol);
+ intf->cur_altsetting->desc.bInterfaceSubClass,
+ intf->cur_altsetting->desc.bInterfaceProtocol);
/* Store our private data in the interface */
usb_set_intfdata(intf, chip);
@@ -569,8 +569,7 @@ static int get_pipes(struct rts51x_chip *chip)
}
if (!ep_in || !ep_out) {
- RTS51X_DEBUGP("Endpoint sanity check failed!"
- "Rejecting dev.\n");
+ RTS51X_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n");
return -EIO;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 3/6] Staging: rts5139: Splitted one-line multiple assignment
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
2014-04-22 21:22 ` [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 2/6] Staging: rts5139: Fixed multi-line code alignment Fabio Falzoi
@ 2014-04-22 21:23 ` Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing Fabio Falzoi
` (2 subsequent siblings)
5 siblings, 0 replies; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:23 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Splitted a multiple assignment on two separate lines.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 28f4631..2be6210 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -607,7 +607,8 @@ static int rts51x_acquire_resources(struct rts51x_chip *chip)
return -ENOMEM;
}
- chip->cmd_buf = chip->rsp_buf = rts51x->iobuf;
+ chip->cmd_buf = rts51x->iobuf;
+ chip->rsp_buf = rts51x->iobuf;
rts51x_init_options(chip);
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
` (2 preceding siblings ...)
2014-04-22 21:23 ` [PATCH v3 3/6] Staging: rts5139: Splitted one-line multiple assignment Fabio Falzoi
@ 2014-04-22 21:23 ` Fabio Falzoi
2014-04-22 22:07 ` Dan Carpenter
2014-04-22 21:23 ` [PATCH v3 5/6] Staging: rts5139: Removed OOM messages Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 6/6] Staging: rts5139: More appropriate use of sizeof operand Fabio Falzoi
5 siblings, 1 reply; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:23 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Define pr_fmt macro to prefix every pr_<level> function in standard way.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 100 +++++++++++++++++++--------------------
1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 2be6210..8a0f9ae 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -23,6 +23,8 @@
* No. 450, Shenhu Road, Suzhou Industry Park, Suzhou, China
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
@@ -109,13 +111,13 @@ static inline void usb_autopm_disable(struct usb_interface *intf)
static void rts51x_try_to_enter_ss(struct rts51x_chip *chip)
{
- RTS51X_DEBUGP("Ready to enter SS state\n");
+ pr_debug("Ready to enter SS state\n");
usb_autopm_enable(chip->usb->pusb_intf);
}
void rts51x_try_to_exit_ss(struct rts51x_chip *chip)
{
- RTS51X_DEBUGP("Exit from SS state\n");
+ pr_debug("Exit from SS state\n");
usb_autopm_disable(chip->usb->pusb_intf);
}
@@ -123,7 +125,7 @@ int rts51x_suspend(struct usb_interface *iface, pm_message_t message)
{
struct rts51x_chip *chip = usb_get_intfdata(iface);
- RTS51X_DEBUGP("%s, message.event = 0x%x\n", __func__, message.event);
+ pr_debug("%s, message.event = 0x%x\n", __func__, message.event);
/* Wait until no command is running */
mutex_lock(&chip->usb->dev_mutex);
@@ -132,11 +134,11 @@ int rts51x_suspend(struct usb_interface *iface, pm_message_t message)
rts51x_do_before_power_down(chip);
if (message.event == PM_EVENT_AUTO_SUSPEND) {
- RTS51X_DEBUGP("Enter SS state");
+ pr_debug("Enter SS state");
chip->resume_from_scsi = 0;
RTS51X_SET_STAT(chip, STAT_SS);
} else {
- RTS51X_DEBUGP("Enter SUSPEND state");
+ pr_debug("Enter SUSPEND state");
RTS51X_SET_STAT(chip, STAT_SUSPEND);
}
@@ -151,7 +153,7 @@ int rts51x_resume(struct usb_interface *iface)
{
struct rts51x_chip *chip = usb_get_intfdata(iface);
- RTS51X_DEBUGP("%s\n", __func__);
+ pr_debug("%s\n", __func__);
if (!RTS51X_CHK_STAT(chip, STAT_SS) || !chip->resume_from_scsi) {
mutex_lock(&chip->usb->dev_mutex);
@@ -159,7 +161,7 @@ int rts51x_resume(struct usb_interface *iface)
if (chip->option.ss_en) {
if (GET_PM_USAGE_CNT(chip) <= 0) {
/* Remote wake up, increase pm_usage_cnt */
- RTS51X_DEBUGP("Incr pm_usage_cnt\n");
+ pr_debug("Incr pm_usage_cnt\n");
SET_PM_USAGE_CNT(chip, 1);
}
}
@@ -179,7 +181,7 @@ int rts51x_reset_resume(struct usb_interface *iface)
{
struct rts51x_chip *chip = usb_get_intfdata(iface);
- RTS51X_DEBUGP("%s\n", __func__);
+ pr_debug("%s\n", __func__);
mutex_lock(&chip->usb->dev_mutex);
@@ -219,7 +221,7 @@ static int rts51x_pre_reset(struct usb_interface *iface)
{
struct rts51x_chip *chip = usb_get_intfdata(iface);
- RTS51X_DEBUGP("%s\n", __func__);
+ pr_debug("%s\n", __func__);
/* Make sure no command runs during the reset */
mutex_lock(&chip->usb->dev_mutex);
@@ -230,7 +232,7 @@ static int rts51x_post_reset(struct usb_interface *iface)
{
struct rts51x_chip *chip = usb_get_intfdata(iface);
- RTS51X_DEBUGP("%s\n", __func__);
+ pr_debug("%s\n", __func__);
/* Report the reset to the SCSI core */
/* usb_stor_report_bus_reset(us); */
@@ -252,7 +254,7 @@ static int rts51x_control_thread(void *__chip)
break;
if (test_bit(FLIDX_DISCONNECTING, &chip->usb->dflags)) {
- RTS51X_DEBUGP("-- exiting from rts51x-control\n");
+ pr_debug("-- exiting from rts51x-control\n");
break;
}
@@ -266,7 +268,7 @@ static int rts51x_control_thread(void *__chip)
if (chip->srb == NULL) {
scsi_unlock(host);
mutex_unlock(&chip->usb->dev_mutex);
- RTS51X_DEBUGP("-- exiting from control thread\n");
+ pr_debug("-- exiting from control thread\n");
break;
}
@@ -282,7 +284,7 @@ static int rts51x_control_thread(void *__chip)
* is UNKNOWN
*/
if (chip->srb->sc_data_direction == DMA_BIDIRECTIONAL) {
- RTS51X_DEBUGP("UNKNOWN data direction\n");
+ pr_debug("UNKNOWN data direction\n");
chip->srb->result = DID_ERROR << 16;
}
@@ -290,16 +292,16 @@ static int rts51x_control_thread(void *__chip)
* the maximum known LUN
*/
else if (chip->srb->device->id) {
- RTS51X_DEBUGP("Bad target number (%d:%d)\n",
- chip->srb->device->id,
- chip->srb->device->lun);
+ pr_debug("Bad target number (%d:%d)\n",
+ chip->srb->device->id,
+ chip->srb->device->lun);
chip->srb->result = DID_BAD_TARGET << 16;
}
else if (chip->srb->device->lun > chip->max_lun) {
- RTS51X_DEBUGP("Bad LUN (%d:%d)\n",
- chip->srb->device->id,
- chip->srb->device->lun);
+ pr_debug("Bad LUN (%d:%d)\n",
+ chip->srb->device->id,
+ chip->srb->device->lun);
chip->srb->result = DID_BAD_TARGET << 16;
}
@@ -317,7 +319,7 @@ static int rts51x_control_thread(void *__chip)
chip->srb->scsi_done(chip->srb);
else
abort :
- RTS51X_DEBUGP("scsi command aborted\n");
+ pr_debug("scsi command aborted\n");
/* If an abort request was received we need to signal that
* the abort has finished. The proper test for this is
@@ -362,7 +364,7 @@ static int rts51x_polling_thread(void *__chip)
/* if the device has disconnected, we are free to exit */
if (test_bit(FLIDX_DISCONNECTING, &chip->usb->dflags)) {
- RTS51X_DEBUGP("-- exiting from rts51x-polling\n");
+ pr_debug("-- exiting from rts51x-polling\n");
break;
}
@@ -432,13 +434,13 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->pusb_dev = interface_to_usbdev(intf);
rts51x->pusb_intf = intf;
rts51x->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
- RTS51X_DEBUGP("Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n",
- le16_to_cpu(rts51x->pusb_dev->descriptor.idVendor),
- le16_to_cpu(rts51x->pusb_dev->descriptor.idProduct),
- le16_to_cpu(rts51x->pusb_dev->descriptor.bcdDevice));
- RTS51X_DEBUGP("Interface Subclass: 0x%02x, Protocol: 0x%02x\n",
- intf->cur_altsetting->desc.bInterfaceSubClass,
- intf->cur_altsetting->desc.bInterfaceProtocol);
+ pr_debug("Vendor: 0x%04x, Product: 0x%04x, Revision: 0x%04x\n",
+ le16_to_cpu(rts51x->pusb_dev->descriptor.idVendor),
+ le16_to_cpu(rts51x->pusb_dev->descriptor.idProduct),
+ le16_to_cpu(rts51x->pusb_dev->descriptor.bcdDevice));
+ pr_debug("Interface Subclass: 0x%02x, Protocol: 0x%02x\n",
+ intf->cur_altsetting->desc.bInterfaceSubClass,
+ intf->cur_altsetting->desc.bInterfaceProtocol);
/* Store our private data in the interface */
usb_set_intfdata(intf, chip);
@@ -448,7 +450,7 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
retval = usb_register_dev(intf, &rts51x_class);
if (retval) {
/* something prevented us from registering this driver */
- RTS51X_DEBUGP("Not able to get a minor for this device.");
+ pr_debug("Not able to get a minor for this device.");
usb_set_intfdata(intf, NULL);
return -ENOMEM;
}
@@ -458,7 +460,7 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->cr = usb_buffer_alloc(rts51x->pusb_dev, sizeof(*rts51x->cr),
GFP_KERNEL, &rts51x->cr_dma);
if (!rts51x->cr) {
- RTS51X_DEBUGP("usb_ctrlrequest allocation failed\n");
+ pr_debug("usb_ctrlrequest allocation failed\n");
usb_set_intfdata(intf, NULL);
return -ENOMEM;
}
@@ -466,7 +468,7 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->iobuf = usb_buffer_alloc(rts51x->pusb_dev, RTS51X_IOBUF_SIZE,
GFP_KERNEL, &rts51x->iobuf_dma);
if (!rts51x->iobuf) {
- RTS51X_DEBUGP("I/O buffer allocation failed\n");
+ pr_debug("I/O buffer allocation failed\n");
usb_set_intfdata(intf, NULL);
return -ENOMEM;
}
@@ -569,7 +571,7 @@ static int get_pipes(struct rts51x_chip *chip)
}
if (!ep_in || !ep_out) {
- RTS51X_DEBUGP("Endpoint sanity check failed! Rejecting dev.\n");
+ pr_debug("Endpoint sanity check failed! Rejecting dev.\n");
return -EIO;
}
@@ -597,13 +599,13 @@ static int rts51x_acquire_resources(struct rts51x_chip *chip)
rts51x->current_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!rts51x->current_urb) {
- RTS51X_DEBUGP("URB allocation failed\n");
+ pr_debug("URB allocation failed\n");
return -ENOMEM;
}
rts51x->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!rts51x->intr_urb) {
- RTS51X_DEBUGP("URB allocation failed\n");
+ pr_debug("URB allocation failed\n");
return -ENOMEM;
}
@@ -623,13 +625,13 @@ static int rts51x_acquire_resources(struct rts51x_chip *chip)
/* Release all our dynamic resources */
static void rts51x_release_resources(struct rts51x_chip *chip)
{
- RTS51X_DEBUGP("-- %s\n", __func__);
+ pr_debug("-- %s\n", __func__);
/* Tell the control thread to exit. The SCSI host must
* already have been removed and the DISCONNECTING flag set
* so that we won't accept any more commands.
*/
- RTS51X_DEBUGP("-- sending exit command to thread\n");
+ pr_debug("-- sending exit command to thread\n");
complete(&chip->usb->cmnd_ready);
if (chip->usb->ctl_thread)
wait_for_completion(&chip->usb->control_exit);
@@ -654,7 +656,7 @@ static void dissociate_dev(struct rts51x_chip *chip)
{
struct rts51x_usb *rts51x = chip->usb;
- RTS51X_DEBUGP("-- %s\n", __func__);
+ pr_debug("-- %s\n", __func__);
/* Free the device-related DMA-mapped buffers */
if (rts51x->cr)
@@ -721,12 +723,12 @@ static int rts51x_probe(struct usb_interface *intf,
int result;
struct task_struct *th;
- RTS51X_DEBUGP("%s detected\n", RTS51X_NAME);
+ pr_debug("%s detected\n", RTS51X_NAME);
rts51x = kzalloc(sizeof(struct rts51x_usb), GFP_KERNEL);
if (!rts51x) {
- printk(KERN_WARNING RTS51X_TIP
- "Unable to allocate rts51x_usb\n");
+ pr_warn(RTS51X_TIP
+ "Unable to allocate rts51x_usb\n");
return -ENOMEM;
}
@@ -736,8 +738,8 @@ static int rts51x_probe(struct usb_interface *intf,
*/
host = scsi_host_alloc(&rts51x_host_template, sizeof(*chip));
if (!host) {
- printk(KERN_WARNING RTS51X_TIP
- "Unable to allocate the scsi host\n");
+ pr_warn(RTS51X_TIP
+ "Unable to allocate the scsi host\n");
kfree(rts51x);
return -ENOMEM;
}
@@ -778,8 +780,7 @@ static int rts51x_probe(struct usb_interface *intf,
/* Start up our control thread */
th = kthread_run(rts51x_control_thread, chip, RTS51X_CTL_THREAD);
if (IS_ERR(th)) {
- printk(KERN_WARNING RTS51X_TIP
- "Unable to start control thread\n");
+ pr_warn("Unable to start control thread\n");
result = PTR_ERR(th);
goto bad_device;
}
@@ -787,7 +788,7 @@ static int rts51x_probe(struct usb_interface *intf,
result = scsi_add_host(rts51x_to_host(chip), &rts51x->pusb_intf->dev);
if (result) {
- printk(KERN_WARNING RTS51X_TIP "Unable to add the scsi host\n");
+ pr_warn("Unable to add the scsi host\n");
goto bad_device;
}
scsi_scan_host(rts51x_to_host(chip));
@@ -795,8 +796,7 @@ static int rts51x_probe(struct usb_interface *intf,
/* Start up our polling thread */
th = kthread_run(rts51x_polling_thread, chip, RTS51X_POLLING_THREAD);
if (IS_ERR(th)) {
- printk(KERN_WARNING RTS51X_TIP
- "Unable to start polling thread\n");
+ pr_warn("Unable to start polling thread\n");
result = PTR_ERR(th);
goto bad_device;
}
@@ -806,7 +806,7 @@ static int rts51x_probe(struct usb_interface *intf,
if (ss_en) {
rts51x->pusb_intf->needs_remote_wakeup = needs_remote_wakeup;
SET_PM_USAGE_CNT(chip, 1);
- RTS51X_DEBUGP("pm_usage_cnt = %d\n", GET_PM_USAGE_CNT(chip));
+ pr_debug("pm_usage_cnt = %d\n", GET_PM_USAGE_CNT(chip));
}
#endif
@@ -814,7 +814,7 @@ static int rts51x_probe(struct usb_interface *intf,
/* We come here if there are any problems */
bad_device:
- RTS51X_DEBUGP("rts51x_probe() failed\n");
+ pr_debug("rts51x_probe() failed\n");
release_everything(chip);
return result;
}
@@ -823,7 +823,7 @@ static void rts51x_disconnect(struct usb_interface *intf)
{
struct rts51x_chip *chip = (struct rts51x_chip *)usb_get_intfdata(intf);
- RTS51X_DEBUGP("rts51x_disconnect() called\n");
+ pr_debug("rts51x_disconnect() called\n");
quiesce_and_remove_host(chip);
release_everything(chip);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 5/6] Staging: rts5139: Removed OOM messages
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
` (3 preceding siblings ...)
2014-04-22 21:23 ` [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing Fabio Falzoi
@ 2014-04-22 21:23 ` Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 6/6] Staging: rts5139: More appropriate use of sizeof operand Fabio Falzoi
5 siblings, 0 replies; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:23 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
All allocation Out Of Memory messages removed.
We rely on the generic OOM message in dump_stack().
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 8a0f9ae..6120410 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -460,7 +460,6 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->cr = usb_buffer_alloc(rts51x->pusb_dev, sizeof(*rts51x->cr),
GFP_KERNEL, &rts51x->cr_dma);
if (!rts51x->cr) {
- pr_debug("usb_ctrlrequest allocation failed\n");
usb_set_intfdata(intf, NULL);
return -ENOMEM;
}
@@ -468,7 +467,6 @@ static int associate_dev(struct rts51x_chip *chip, struct usb_interface *intf)
rts51x->iobuf = usb_buffer_alloc(rts51x->pusb_dev, RTS51X_IOBUF_SIZE,
GFP_KERNEL, &rts51x->iobuf_dma);
if (!rts51x->iobuf) {
- pr_debug("I/O buffer allocation failed\n");
usb_set_intfdata(intf, NULL);
return -ENOMEM;
}
@@ -598,16 +596,12 @@ static int rts51x_acquire_resources(struct rts51x_chip *chip)
int retval;
rts51x->current_urb = usb_alloc_urb(0, GFP_KERNEL);
- if (!rts51x->current_urb) {
- pr_debug("URB allocation failed\n");
+ if (!rts51x->current_urb)
return -ENOMEM;
- }
rts51x->intr_urb = usb_alloc_urb(0, GFP_KERNEL);
- if (!rts51x->intr_urb) {
- pr_debug("URB allocation failed\n");
+ if (!rts51x->intr_urb)
return -ENOMEM;
- }
chip->cmd_buf = rts51x->iobuf;
chip->rsp_buf = rts51x->iobuf;
@@ -726,11 +720,8 @@ static int rts51x_probe(struct usb_interface *intf,
pr_debug("%s detected\n", RTS51X_NAME);
rts51x = kzalloc(sizeof(struct rts51x_usb), GFP_KERNEL);
- if (!rts51x) {
- pr_warn(RTS51X_TIP
- "Unable to allocate rts51x_usb\n");
+ if (!rts51x)
return -ENOMEM;
- }
/*
* Ask the SCSI layer to allocate a host structure, with extra
@@ -738,8 +729,6 @@ static int rts51x_probe(struct usb_interface *intf,
*/
host = scsi_host_alloc(&rts51x_host_template, sizeof(*chip));
if (!host) {
- pr_warn(RTS51X_TIP
- "Unable to allocate the scsi host\n");
kfree(rts51x);
return -ENOMEM;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 6/6] Staging: rts5139: More appropriate use of sizeof operand
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
` (4 preceding siblings ...)
2014-04-22 21:23 ` [PATCH v3 5/6] Staging: rts5139: Removed OOM messages Fabio Falzoi
@ 2014-04-22 21:23 ` Fabio Falzoi
5 siblings, 0 replies; 10+ messages in thread
From: Fabio Falzoi @ 2014-04-22 21:23 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, Fabio Falzoi
Use the pointer rts51x to get the size of the struct.
Signed-off-by: Fabio Falzoi <fabio.falzoi84@gmail.com>
---
drivers/staging/rts5139/rts51x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rts5139/rts51x.c b/drivers/staging/rts5139/rts51x.c
index 6120410..8529cba 100644
--- a/drivers/staging/rts5139/rts51x.c
+++ b/drivers/staging/rts5139/rts51x.c
@@ -719,7 +719,7 @@ static int rts51x_probe(struct usb_interface *intf,
pr_debug("%s detected\n", RTS51X_NAME);
- rts51x = kzalloc(sizeof(struct rts51x_usb), GFP_KERNEL);
+ rts51x = kzalloc(sizeof(*rts51x), GFP_KERNEL);
if (!rts51x)
return -ENOMEM;
--
1.9.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced
2014-04-22 21:22 ` [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced Fabio Falzoi
@ 2014-04-22 22:03 ` Dan Carpenter
0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2014-04-22 22:03 UTC (permalink / raw)
To: Fabio Falzoi; +Cc: gregkh, devel, linux-kernel
On Tue, Apr 22, 2014 at 11:22:59PM +0200, Fabio Falzoi wrote:
> @@ -316,7 +316,7 @@ static int rts51x_control_thread(void *__chip)
> if (chip->srb->result != DID_ABORT << 16)
> chip->srb->scsi_done(chip->srb);
> else
> -SkipForAbort :
> +abort :
Just a comment (no need to resend). Next time remove the space before
the colon.
abort:
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing
2014-04-22 21:23 ` [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing Fabio Falzoi
@ 2014-04-22 22:07 ` Dan Carpenter
2014-04-22 22:10 ` Dan Carpenter
0 siblings, 1 reply; 10+ messages in thread
From: Dan Carpenter @ 2014-04-22 22:07 UTC (permalink / raw)
To: Fabio Falzoi; +Cc: gregkh, devel, linux-kernel
On Tue, Apr 22, 2014 at 11:23:02PM +0200, Fabio Falzoi wrote:
> Define pr_fmt macro to prefix every pr_<level> function in standard way.
>
In the end we will want to remove all these debugging messages. The
error conditions probably already have a print, the function tracing is
done better with ftrace, etc.
Also the pr_ functions have fallen out of fashion and all the cool kids
use dev_ prefixed printks now. (Doesn't really apply to this patch per
se).
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing
2014-04-22 22:07 ` Dan Carpenter
@ 2014-04-22 22:10 ` Dan Carpenter
0 siblings, 0 replies; 10+ messages in thread
From: Dan Carpenter @ 2014-04-22 22:10 UTC (permalink / raw)
To: Fabio Falzoi; +Cc: devel, gregkh, linux-kernel
On Wed, Apr 23, 2014 at 01:07:57AM +0300, Dan Carpenter wrote:
> On Tue, Apr 22, 2014 at 11:23:02PM +0200, Fabio Falzoi wrote:
> > Define pr_fmt macro to prefix every pr_<level> function in standard way.
> >
>
> In the end we will want to remove all these debugging messages.
Ah. I see that you do remove some in a later patch.
Fine fine. I have no problems with this patchset. Seems like a nice
cleanup. Thanks.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-04-22 22:10 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 21:22 [PATCH v3 0/6] Staging: rts5139: Fix coding style Fabio Falzoi
2014-04-22 21:22 ` [PATCH v3 1/6] Staging: rts5139: Camel case labels replaced Fabio Falzoi
2014-04-22 22:03 ` Dan Carpenter
2014-04-22 21:23 ` [PATCH v3 2/6] Staging: rts5139: Fixed multi-line code alignment Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 3/6] Staging: rts5139: Splitted one-line multiple assignment Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 4/6] Staging: rts5139: Use standard pr_<level> prefixing Fabio Falzoi
2014-04-22 22:07 ` Dan Carpenter
2014-04-22 22:10 ` Dan Carpenter
2014-04-22 21:23 ` [PATCH v3 5/6] Staging: rts5139: Removed OOM messages Fabio Falzoi
2014-04-22 21:23 ` [PATCH v3 6/6] Staging: rts5139: More appropriate use of sizeof operand Fabio Falzoi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.