block: reduce spin_lock critical region
PATCH 1/1 block: reduce spin_lock critical region
the critical region is originally composed by a conditional plus a memory copy, the memory copy routine don't need protection. Moving the memcpy() outside the conditional also help to fix the 16 compiler warning messages generated in __u8 sn[16] def.
Signed-off-by Eduardo Silva <[email protected]>
--- drivers/block/cciss.c | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-)
drivers/block/cciss.c +9 -10
@@ -621,20 +621,19 @@ static ssize_t dev_show_unique_id(struct device *dev,spin_lock_irqsave (&h->lock, flags);if (h->busy_configuring) ret = -EBUSY ; -else -memcpy (sn, drv->serial_no,sizeof (sn));spin_unlock_irqrestore (&h->lock, flags);if (ret)return ret; -else -return snprintf (buf,16 *2 +2 , -"%02X%02X%02X%02X%02X%02X%02X%02X" -"%02X%02X%02X%02X%02X%02X%02X%02X\n" , - sn[0 ], sn[1 ], sn[2 ], sn[3 ], - sn[4 ], sn[5 ], sn[6 ], sn[7 ], - sn[8 ], sn[9 ], sn[10 ], sn[11 ], - sn[12 ], sn[13 ], sn[14 ], sn[15 ]); + +memcpy (sn, drv->serial_no,sizeof (sn)); +return snprintf (buf,16 *2 +2 , +"%02X%02X%02X%02X%02X%02X%02X%02X" +"%02X%02X%02X%02X%02X%02X%02X%02X\n" , + sn[0 ], sn[1 ], sn[2 ], sn[3 ], + sn[4 ], sn[5 ], sn[6 ], sn[7 ], + sn[8 ], sn[9 ], sn[10 ], sn[11 ], + sn[12 ], sn[13 ], sn[14 ], sn[15 ]); } static DEVICE_ATTR(unique_id, S_IRUGO, dev_show_unique_id, NULL);
Signature · 1 line
1.7.4.1