From patchwork Thu Oct 20 06:33:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gwendal Grignou X-Patchwork-Id: 120728 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 03AA5B6F94 for ; Thu, 20 Oct 2011 17:34:01 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751164Ab1JTGd6 (ORCPT ); Thu, 20 Oct 2011 02:33:58 -0400 Received: from smtp-out.google.com ([216.239.44.51]:32645 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751131Ab1JTGd5 (ORCPT ); Thu, 20 Oct 2011 02:33:57 -0400 Received: from wpaz5.hot.corp.google.com (wpaz5.hot.corp.google.com [172.24.198.69]) by smtp-out.google.com with ESMTP id p9K6XuEs016295; Wed, 19 Oct 2011 23:33:56 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1319092436; bh=M9kciOq/R3xHfJqeBi+hX3WBBmU=; h=From:To:Cc:Subject:Date:Message-Id; b=tHQ5xa2RHI341i+csCqW0xMwM+IEZc2yIzjl18x+gBwwkzAr4wGUf4BIQyjyz89Ju 9KnY2WvrcbM78RzBYOjGw== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer; b=Dc0S537oK0g50X9AflorttM0mYPak92Fp9pzNJihD6VIcp3qcodgpIwdR9SnHERLc bsxsdTvVySQW1FVFpI+JQ== Received: from hippo3.mtv.corp.google.com (hippo3.mtv.corp.google.com [172.18.64.15]) by wpaz5.hot.corp.google.com with ESMTP id p9K6XtWx008208; Wed, 19 Oct 2011 23:33:56 -0700 Received: by hippo3.mtv.corp.google.com (Postfix, from userid 60833) id 93AD320CC4; Wed, 19 Oct 2011 23:33:55 -0700 (PDT) From: Gwendal Grignou To: htejun@gmail.com Cc: linux-ide@vger.kernel.org, Gwendal Grignou Subject: [PATCH] [libata-transport]Fix display of sata speed Date: Wed, 19 Oct 2011 23:33:53 -0700 Message-Id: <1319092433-12726-1-git-send-email-gwendal@google.com> X-Mailer: git-send-email 1.7.3.1 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org On a system with controller and disk supporting 6.0Gbps, sata_spd was incorrectly set to 3.0Gbps. Signed-off-by: Gwendal Grignou --- drivers/ata/libata-transport.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index ce9dc62..1172a67 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c @@ -312,25 +312,25 @@ int ata_tport_add(struct device *parent, /* * ATA link attributes */ +static int noop(int x) { return x; } - -#define ata_link_show_linkspeed(field) \ +#define ata_link_show_linkspeed(field, format) \ static ssize_t \ show_ata_link_##field(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ struct ata_link *link = transport_class_to_link(dev); \ \ - return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \ + return sprintf(buf,"%s\n", sata_spd_string(format(link->field))); \ } -#define ata_link_linkspeed_attr(field) \ - ata_link_show_linkspeed(field) \ +#define ata_link_linkspeed_attr(field, format) \ + ata_link_show_linkspeed(field, format) \ static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL) -ata_link_linkspeed_attr(hw_sata_spd_limit); -ata_link_linkspeed_attr(sata_spd_limit); -ata_link_linkspeed_attr(sata_spd); +ata_link_linkspeed_attr(hw_sata_spd_limit, fls); +ata_link_linkspeed_attr(sata_spd_limit, fls); +ata_link_linkspeed_attr(sata_spd, noop); static DECLARE_TRANSPORT_CLASS(ata_link_class,