Re: [PATCH 3/7] [SCSI] scst: Add scst_local driver.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 28, 2010 at 7:51 PM, Konrad Rzeszutek Wilk
<konrad@xxxxxxxxxx> wrote:
> On Monday 20
>> +#define TRUE 1
>> +#define FALSE 0
>
> can't you use 'true' or 'false'?
> .. snip..
>> +static int scst_local_get_sas_transport_id(struct scst_local_sess *sess,
>> +     uint8_t **transport_id, int *len)
>> +{
>> +     int res = 0;
>> +     int tr_id_size = 0;
>> +     uint8_t *tr_id = NULL;
>> +
>> +     tr_id_size = 24;  /* A SAS TransportID */
>> +
>> +     tr_id = kzalloc(tr_id_size, GFP_KERNEL);
>> +     if (tr_id == NULL) {
>> +             PRINT_ERROR("Allocation of TransportID (size %d) failed",
>> +                     tr_id_size);
>
> pr_err? Or is this based on a module parameter?

The macro PRINT_ERROR() has been defined in the header file
include/scst/scst_debug.h. For this macro and also for related macros
(e.g. TRACE_DBG()) the user can configure via debugfs whether or not
PID, function name and/or line number should be included in the
generated messages.

>> +             res = -ENOMEM;
>> +             goto out;
>> +     }
>> +
>> +     tr_id[0] = 0x00 | SCSI_TRANSPORTID_PROTOCOLID_SAS;
>
> Hmm, why the 0x00? Can't you just do an assigment?

If I do not receive further feedback, I will queue the patch below:

[SCSI] scst_local: Clean up source code

Use true and false instead of TRUE and FALSE and remove one occurrence
of "0x00 |".

Signed-off-by: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Acked-by: Bart Van Assche <bvanassche@xxxxxxx>

diff --git a/drivers/scst/scst_local/scst_local.c
b/drivers/scst/scst_local/scst_local.c
index a3804cb..4a20e40 100644
--- a/drivers/scst/scst_local/scst_local.c
+++ b/drivers/scst/scst_local/scst_local.c
@@ -50,9 +50,6 @@
 static unsigned long scst_local_trace_flag = SCST_LOCAL_DEFAULT_LOG_FLAGS;
 #endif

-#define TRUE 1
-#define FALSE 0
-
 #define SCST_LOCAL_VERSION "1.0.0"
 #define SCST_LOCAL_VERSION_DATE "20100910"

@@ -147,7 +144,7 @@ static int scst_local_get_sas_transport_id(struct
scst_local_sess *sess,
 		goto out;
 	}

-	tr_id[0] = 0x00 | SCSI_TRANSPORTID_PROTOCOLID_SAS;
+	tr_id[0] = SCSI_TRANSPORTID_PROTOCOLID_SAS;

 	/*
 	 * Assemble a valid SAS address = 0x5OOUUIIR12345678 ... Does SCST
@@ -664,7 +661,7 @@ static int scst_local_abort(struct scsi_cmnd *SCpnt)
 	sess = to_scst_lcl_sess(scsi_get_device(SCpnt->device->host));

 	ret = scst_rx_mgmt_fn_tag(sess->scst_sess, SCST_ABORT_TASK, SCpnt->tag,
-				 FALSE, &dev_reset_completion);
+				 false, &dev_reset_completion);

 	/* Now wait for the completion ... */
 	wait_for_completion_interruptible(&dev_reset_completion);
@@ -688,7 +685,7 @@ static int scst_local_device_reset(struct scsi_cmnd *SCpnt)
 	lun = cpu_to_be16(SCpnt->device->lun);

 	ret = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_LUN_RESET,
-			(const uint8_t *)&lun, sizeof(lun), FALSE,
+			(const uint8_t *)&lun, sizeof(lun), false,
 			&dev_reset_completion);

 	/* Now wait for the completion ... */
@@ -713,7 +710,7 @@ static int scst_local_target_reset(struct scsi_cmnd *SCpnt)
 	lun = cpu_to_be16(SCpnt->device->lun);

 	ret = scst_rx_mgmt_fn_lun(sess->scst_sess, SCST_TARGET_RESET,
-			(const uint8_t *)&lun, sizeof(lun), FALSE,
+			(const uint8_t *)&lun, sizeof(lun), false,
 			&dev_reset_completion);

 	/* Now wait for the completion ... */
@@ -795,7 +792,7 @@ static int scst_local_queuecommand(struct Scsi_Host *SChost,
 	 */
 	lun = cpu_to_be16(SCpnt->device->lun);
 	scst_cmd = scst_rx_cmd(sess->scst_sess, (const uint8_t *)&lun,
-			       sizeof(lun), SCpnt->cmnd, SCpnt->cmd_len, TRUE);
+			       sizeof(lun), SCpnt->cmnd, SCpnt->cmd_len, true);
 	if (!scst_cmd) {
 		PRINT_ERROR("%s", "scst_rx_cmd() failed");
 		return -ENOMEM;
@@ -1214,7 +1211,7 @@ static void scst_local_release_adapter(struct device *dev)

 	cancel_work_sync(&sess->aen_work);

-	scst_unregister_session(sess->scst_sess, TRUE, NULL);
+	scst_unregister_session(sess->scst_sess, true, NULL);

 	kfree(sess);

@@ -1292,7 +1289,7 @@ unregister_dev:
 	device_unregister(&sess->dev);

 unregister_session:
-	scst_unregister_session(sess->scst_sess, TRUE, NULL);
+	scst_unregister_session(sess->scst_sess, true, NULL);

 out_free:
 	kfree(sess);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux