[PATCH] staging: rts5208: coding style clean-ups

From: Sohom Bhattacharjee
Date: Mon Mar 21 2016 - 13:23:57 EST


fixed *only* comments that did not follow kernel coding style.
the errors were caught by the checkpatch.pl tool

Signed-off-by: Sohom Bhattacharjee <soham.bhattacharjee15@xxxxxxxxx>
---
drivers/staging/rts5208/rtsx.c | 55 +++++++++++++++++---------
drivers/staging/rts5208/rtsx_chip.h | 53 ++++++++++++++++---------
drivers/staging/rts5208/rtsx_transport.c | 66 +++++++++++++++++++++-----------
3 files changed, 114 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 1fe8e3e..9abde0a 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -1,4 +1,5 @@
-/* Driver for Realtek PCI-Express card reader
+/*
+ * Driver for Realtek PCI-Express card reader
*
* Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
*
@@ -81,17 +82,20 @@ static int slave_alloc(struct scsi_device *sdev)

static int slave_configure(struct scsi_device *sdev)
{
- /* Scatter-gather buffers (all but the last) must have a length
+ /*
+ * Scatter-gather buffers (all but the last) must have a length
* divisible by the bulk maxpacket size. Otherwise a data packet
* would end up being short, causing a premature end to the data
* transfer. Since high-speed bulk pipes have a maxpacket size
* of 512, we'll use that as the scsi device queue's DMA alignment
* mask. Guaranteeing proper alignment of the first buffer will
* have the desired effect because, except at the beginning and
- * the end, scatter-gather buffers follow page boundaries. */
+ * the end, scatter-gather buffers follow page boundaries.
+ */
blk_queue_dma_alignment(sdev->request_queue, (512 - 1));

- /* Set the SCSI level to at least 2. We'll leave it at 3 if that's
+ /*
+ * Set the SCSI level to at least 2. We'll leave it at 3 if that's
* what is originally reported. We need this to avoid confusing
* the SCSI layer with devices that report 0 or 1, but need 10-byte
* commands (ala ATAPI devices behind certain bridges, or devices
@@ -186,8 +190,10 @@ static int command_abort(struct scsi_cmnd *srb)
return SUCCESS;
}

-/* This invokes the transport reset mechanism to reset the state of the
- * device */
+/*
+ * This invokes the transport reset mechanism to reset the state of the
+ * device
+ */
static int device_reset(struct scsi_cmnd *srb)
{
int result = 0;
@@ -500,8 +506,8 @@ SkipForAbort:
mutex_unlock(&dev->dev_mutex);
} /* for (;;) */

- /* notify the exit routine that we're actually exiting now
- *
+ /*
+ * notify the exit routine that we're actually exiting now
* complete()/wait_for_completion() is similar to up()/down(),
* except that complete() is safe in the case where the structure
* is getting deleted in a parallel mode of execution (i.e. just
@@ -633,7 +639,8 @@ static void rtsx_release_resources(struct rtsx_dev *dev)
{
dev_info(&dev->pci->dev, "-- %s\n", __func__);

- /* Tell the control thread to exit. The SCSI host must
+ /*
+ * Tell the control thread to exit. The SCSI host must
* already have been removed so it won't try to queue
* any more commands.
*/
@@ -665,15 +672,19 @@ static void rtsx_release_resources(struct rtsx_dev *dev)
kfree(dev->chip);
}

-/* First stage of disconnect processing: stop all commands and remove
- * the host */
+/*
+ * First stage of disconnect processing: stop all commands and remove
+ * the host
+ */
static void quiesce_and_remove_host(struct rtsx_dev *dev)
{
struct Scsi_Host *host = rtsx_to_host(dev);
struct rtsx_chip *chip = dev->chip;

- /* Prevent new transfers, stop the current command, and
- * interrupt a SCSI-scan or device-reset delay */
+ /*
+ * Prevent new transfers, stop the current command, and
+ * interrupt a SCSI-scan or device-reset delay
+ */
mutex_lock(&dev->dev_mutex);
scsi_lock(host);
rtsx_set_stat(chip, RTSX_STAT_DISCONNECT);
@@ -685,9 +696,11 @@ static void quiesce_and_remove_host(struct rtsx_dev *dev)
/* Wait some time to let other threads exist */
wait_timeout(100);

- /* queuecommand won't accept any new commands and the control
+ /*
+ * queuecommand won't accept any new commands and the control
* thread won't execute a previously-queued command. If there
- * is such a command pending, complete it with an error. */
+ * is such a command pending, complete it with an error.
+ */
mutex_lock(&dev->dev_mutex);
if (chip->srb) {
chip->srb->result = DID_NO_CONNECT << 16;
@@ -707,8 +720,10 @@ static void release_everything(struct rtsx_dev *dev)
{
rtsx_release_resources(dev);

- /* Drop our reference to the host; the SCSI core will free it
- * when the refcount becomes 0. */
+ /*
+ * Drop our reference to the host; the SCSI core will free it
+ * when the refcount becomes 0.
+ */
scsi_host_put(rtsx_to_host(dev));
}

@@ -950,8 +965,10 @@ static int rtsx_probe(struct pci_dev *pci,

rtsx_init_chip(dev->chip);

- /* set the supported max_lun and max_id for the scsi host
- * NOTE: the minimal value of max_id is 1 */
+ /*
+ * set the supported max_lun and max_id for the scsi host
+ * NOTE: the minimal value of max_id is 1
+ */
host->max_id = 1;
host->max_lun = dev->chip->max_lun;

diff --git a/drivers/staging/rts5208/rtsx_chip.h b/drivers/staging/rts5208/rtsx_chip.h
index c295b1e..56741c6 100644
--- a/drivers/staging/rts5208/rtsx_chip.h
+++ b/drivers/staging/rts5208/rtsx_chip.h
@@ -1,4 +1,5 @@
-/* Driver for Realtek PCI-Express card reader
+/*
+ * Driver for Realtek PCI-Express card reader
* Header file
*
* Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
@@ -44,8 +45,10 @@
#define MG_SET_ICV_SLOW
/* HW may miss ERR/CMDNK signal when sampling INT status. */
#define MS_SAMPLE_INT_ERR
- /* HW DO NOT support Wait_INT function during READ_BYTES
- * transfer mode */
+ /*
+ * HW DO NOT support Wait_INT function during READ_BYTES
+ * transfer mode
+ */
#define READ_BYTES_WAIT_INT
#endif

@@ -92,8 +95,9 @@
#define PM_S1 1
#define PM_S3 3

-/*
+/*--------------------------------
* Transport return codes
+ *--------------------------------
*/

#define TRANSPORT_GOOD 0 /* Transport good, command good */
@@ -102,17 +106,19 @@
#define TRANSPORT_ERROR 3 /* Transport bad (i.e. device dead) */


-/*-----------------------------------
- Start-Stop-Unit
------------------------------------*/
+/*---------------------------------
+ * Start-Stop-Unit
+ *---------------------------------
+ */
#define STOP_MEDIUM 0x00 /* access disable */
#define MAKE_MEDIUM_READY 0x01 /* access enable */
#define UNLOAD_MEDIUM 0x02 /* unload */
#define LOAD_MEDIUM 0x03 /* load */

-/*-----------------------------------
- STANDARD_INQUIRY
------------------------------------*/
+/*--------------------------------
+ * STANDARD_INQUIRY
+ *--------------------------------
+ */
#define QULIFIRE 0x00
#define AENC_FNC 0x00
#define TRML_IOP 0x00
@@ -131,15 +137,19 @@
/* Dynamic flag definitions: used in set_bit() etc. */
#define RTSX_FLIDX_TRANS_ACTIVE 18 /* 0x00040000 transfer is active */
#define RTSX_FLIDX_ABORTING 20 /* 0x00100000 abort is in
- * progress */
+ * progress
+ */
#define RTSX_FLIDX_DISCONNECTING 21 /* 0x00200000 disconnect
- * in progress */
+ * in progress
+ */
#define ABORTING_OR_DISCONNECTING ((1UL << US_FLIDX_ABORTING) | \
(1UL << US_FLIDX_DISCONNECTING))
#define RTSX_FLIDX_RESETTING 22 /* 0x00400000 device reset
- * in progress */
+ * in progress
+ */
#define RTSX_FLIDX_TIMED_OUT 23 /* 0x00800000 SCSI
- * midlayer timed out */
+ * midlayer timed out
+ */

#define DRCT_ACCESS_DEV 0x00 /* Direct Access Device */
#define RMB_DISC 0x80 /* The Device is Removable */
@@ -175,8 +185,10 @@
#define USED_EXIST 0x02

/*-----------------------------------
- SENSE_DATA
------------------------------------*/
+ * SENSE_DATA
+ *-----------------------------------
+ */
+
/*---- valid ----*/
#define SENSE_VALID 0x80 /* Sense data is valid as SCSI2 */
#define SENSE_INVALID 0x00 /* Sense data is invalid as SCSI2 */
@@ -713,8 +725,10 @@ struct rtsx_chip {

unsigned long need_release; /* need release bit map */
unsigned long need_reset; /* need reset
- * bit map */
- /* Flag to indicate that this card is just resumed from SS state,
+ * bit map
+ */
+ /*
+ * Flag to indicate that this card is just resumed from SS state,
* and need released before being resetted
*/
unsigned long need_reinit;
@@ -733,7 +747,8 @@ struct rtsx_chip {
u8 card_wp; /* card write protected bit map */

u8 lun_mc; /* flag to indicate whether to answer
- * MediaChange */
+ * MediaChange
+ */

#ifndef LED_AUTO_BLINK
int led_toggle_counter;
diff --git a/drivers/staging/rts5208/rtsx_transport.c b/drivers/staging/rts5208/rtsx_transport.c
index f27491e..5d56bb7 100644
--- a/drivers/staging/rts5208/rtsx_transport.c
+++ b/drivers/staging/rts5208/rtsx_transport.c
@@ -1,4 +1,5 @@
-/* Driver for Realtek PCI-Express card reader
+/*
+ * Driver for Realtek PCI-Express card reader
*
* Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
*
@@ -26,17 +27,21 @@

#include "rtsx.h"

-/***********************************************************************
+/*
+ **********************************************************************
* Scatter-gather transfer buffer access routines
- ***********************************************************************/
+ **********************************************************************
+ */

-/* Copy a buffer of length buflen to/from the srb's transfer buffer.
+/*
+ * Copy a buffer of length buflen to/from the srb's transfer buffer.
* (Note: for scatter-gather transfers (srb->use_sg > 0), srb->request_buffer
* points to a list of s-g entries and we ignore srb->request_bufflen.
* For non-scatter-gather transfers, srb->request_buffer points to the
* transfer buffer itself and srb->request_bufflen is the buffer's length.)
* Update the *index and *offset variables so that the next copy will
- * pick up from where this one left off. */
+ * pick up from where this one left off.
+ */

unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
@@ -44,8 +49,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
{
unsigned int cnt;

- /* If not using scatter-gather, just transfer the data directly.
- * Make certain it will fit in the available buffer space. */
+ /*
+ * If not using scatter-gather, just transfer the data directly.
+ * Make certain it will fit in the available buffer space.
+ */
if (scsi_sg_count(srb) == 0) {
if (*offset >= scsi_bufflen(srb))
return 0;
@@ -58,22 +65,26 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
*offset, cnt);
*offset += cnt;

- /* Using scatter-gather. We have to go through the list one entry
+ /*
+ * Using scatter-gather. We have to go through the list one entry
* at a time. Each s-g entry contains some number of pages, and
* each page has to be kmap()'ed separately. If the page is already
* in kernel-addressable memory then kmap() will return its address.
* If the page is not directly accessible -- such as a user buffer
* located in high memory -- then kmap() will map it to a temporary
- * position in the kernel's virtual address space. */
+ * position in the kernel's virtual address space.
+ */
} else {
struct scatterlist *sg =
(struct scatterlist *) scsi_sglist(srb)
+ *index;

- /* This loop handles a single s-g list entry, which may
+ /*
+ * This loop handles a single s-g list entry, which may
* include multiple pages. Find the initial page structure
* and the starting offset within the page, and update
- * the *offset and *index values for the next loop. */
+ * the *offset and *index values for the next loop.
+ */
cnt = 0;
while (cnt < buflen && *index < scsi_sg_count(srb)) {
struct page *page = sg_page(sg) +
@@ -95,9 +106,11 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
++sg;
}

- /* Transfer the data for all the pages in this
+ /*
+ * Transfer the data for all the pages in this
* s-g entry. For each page: call kmap(), do the
- * transfer, and call kunmap() immediately after. */
+ * transfer, and call kunmap() immediately after.
+ */
while (sglen > 0) {
unsigned int plen = min(sglen, (unsigned int)
PAGE_SIZE - poff);
@@ -122,8 +135,10 @@ unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
return cnt;
}

-/* Store the contents of buffer into srb's transfer buffer and set the
-* SCSI residue. */
+/*
+ * Store the contents of buffer into srb's transfer buffer and set the
+ * SCSI residue.
+ */
void rtsx_stor_set_xfer_buf(unsigned char *buffer,
unsigned int buflen, struct scsi_cmnd *srb)
{
@@ -147,11 +162,14 @@ void rtsx_stor_get_xfer_buf(unsigned char *buffer,
}


-/***********************************************************************
+/*
+ **********************************************************************
* Transport routines
- ***********************************************************************/
+ **********************************************************************
+ */

-/* Invoke the transport and basic error-handling/recovery methods
+/*
+ * Invoke the transport and basic error-handling/recovery methods
*
* This is used to send the message to the device and receive the response.
*/
@@ -161,7 +179,8 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)

result = rtsx_scsi_handler(srb, chip);

- /* if the command gets aborted by the higher layers, we need to
+ /*
+ * if the command gets aborted by the higher layers, we need to
* short-circuit all other processing
*/
if (rtsx_chk_stat(chip, RTSX_STAT_ABORT)) {
@@ -194,9 +213,11 @@ void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip)

return;

- /* Error and abort processing: try to resynchronize with the device
+ /*
+ * Error and abort processing: try to resynchronize with the device
* by issuing a port reset. If that fails, try a class-specific
- * device reset. */
+ * device reset.
+ */
Handle_Errors:
return;
}
@@ -368,7 +389,8 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card,
resid = size;
sg_ptr = sg;
chip->sgi = 0;
- /* Usually the next entry will be @sg@ + 1, but if this sg element
+ /*
+ * Usually the next entry will be @sg@ + 1, but if this sg element
* is part of a chained scatterlist, it could jump to the start of
* a new scatterlist array. So here we use sg_next to move to
* the proper sg
--
2.5.0