aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-transport.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@google.com>2013-10-25 19:28:57 -0400
committerTejun Heo <tj@kernel.org>2013-10-27 07:43:25 -0400
commit3e85c3ecbc520751324a191d23bb94873ed01b10 (patch)
tree458092e84f141b9a2ed4e46aac214db42815d62e /drivers/ata/libata-transport.c
parent8b789d89813fae01908ecc825c9dfc0ec90647ad (diff)
libata: Fix display of sata speed
6.0 Gbps link speed was not decoded properly: speed was reported at 3.0 Gbps only. Tested: On a machine where libata reports 6.0 Gbps in /var/log/messages: ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300) Before: cat /sys/class/ata_link/link1/sata_spd 3.0 Gbps After: cat /sys/class/ata_link/link1/sata_spd 6.0 Gbps Signed-off-by: Gwendal Grignou <gwendal@google.com> Signed-off-by: Tejun Heo <tj@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/ata/libata-transport.c')
-rw-r--r--drivers/ata/libata-transport.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index 150a917f0c3c..e37413228228 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -321,25 +321,25 @@ int ata_tport_add(struct device *parent,
321/* 321/*
322 * ATA link attributes 322 * ATA link attributes
323 */ 323 */
324static int noop(int x) { return x; }
324 325
325 326#define ata_link_show_linkspeed(field, format) \
326#define ata_link_show_linkspeed(field) \
327static ssize_t \ 327static ssize_t \
328show_ata_link_##field(struct device *dev, \ 328show_ata_link_##field(struct device *dev, \
329 struct device_attribute *attr, char *buf) \ 329 struct device_attribute *attr, char *buf) \
330{ \ 330{ \
331 struct ata_link *link = transport_class_to_link(dev); \ 331 struct ata_link *link = transport_class_to_link(dev); \
332 \ 332 \
333 return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \ 333 return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \
334} 334}
335 335
336#define ata_link_linkspeed_attr(field) \ 336#define ata_link_linkspeed_attr(field, format) \
337 ata_link_show_linkspeed(field) \ 337 ata_link_show_linkspeed(field, format) \
338static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL) 338static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL)
339 339
340ata_link_linkspeed_attr(hw_sata_spd_limit); 340ata_link_linkspeed_attr(hw_sata_spd_limit, fls);
341ata_link_linkspeed_attr(sata_spd_limit); 341ata_link_linkspeed_attr(sata_spd_limit, fls);
342ata_link_linkspeed_attr(sata_spd); 342ata_link_linkspeed_attr(sata_spd, noop);
343 343
344 344
345static DECLARE_TRANSPORT_CLASS(ata_link_class, 345static DECLARE_TRANSPORT_CLASS(ata_link_class,