Re: [PATCH v1.0 7/16] arcmsr: revise message_isr_bh_fn to delete duplicate code

From: Dan Carpenter
Date: Fri May 02 2014 - 04:50:01 EST


On Wed, Apr 30, 2014 at 07:02:37PM +0800, ching wrote:
> + }
> + atomic_inc(&acb->rq_map_token);

This patch is a nice cleanup but it would be even better if you flipped
this condition around.

> + if (readl(signature) == ARCMSR_SIGNATURE_GET_CONFIG) {

if (readl(signature) != ARCMSR_SIGNATURE_GET_CONFIG)
return;

> + for (target = 0; target < ARCMSR_MAX_TARGETID - 1;
> + target++) {
> + temp = readb(devicemap);
> + diff = (*acb_dev_map) ^ temp;
> + if (diff != 0) {
> + *acb_dev_map = temp;
> + for (lun = 0; lun < ARCMSR_MAX_TARGETLUN;
> + lun++) {
> + if ((diff & 0x01) == 1 &&
> + (temp & 0x01) == 1) {
> + scsi_add_device(acb->host,
> + 0, target, lun);
> + } else if ((diff & 0x01) == 1
> + && (temp & 0x01) == 0) {
> + psdev =
> + scsi_device_lookup(acb->host,
> + 0, target, lun);

The whitespace is weird here. Do:

psdev = scsi_device_lookup(acb->host,
0, target, lun);

> + if (psdev != NULL) {
> + scsi_remove_device(psdev);
> + scsi_device_put(psdev);
> }
> }
> - devicemap++;
> - acb_dev_map++;
> + temp >>= 1;
> + diff >>= 1;
> }
> }
> + devicemap++;
> + acb_dev_map++;
> }

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/