From: Mark Lord <liml@rtr.ca>
To: Robert Hancock <hancockrwd@gmail.com>
Cc: ide <linux-ide@vger.kernel.org>, Jeff Garzik <jeff@garzik.org>,
Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH #upstream] libata: enhance command parsing
Date: Sat, 22 Aug 2009 10:02:03 -0400 [thread overview]
Message-ID: <4A8FFA5B.30209@rtr.ca> (raw)
In-Reply-To: <4A8F88B2.6050900@gmail.com>
Robert Hancock wrote:
> On 07/30/2009 03:27 PM, Robert Hancock wrote:
>> This patch enhances libata's command name output (used for error
>> handling and
>> ACPI command execution status) to include more commands from the latest
>> ACS-2 spec draft, and to support parsing sub-commands based on the feature
>> and nsect registers instead of just the command code. To support this, the
>> ata_get_cmd_descript function now takes the entire taskfile as input.
>> The function has been changed to use a switch statement instead of a data
>> array for more efficiency and compile-time checking for duplicate entries.
>>
>> Also, the ATA_CMD_PMP_READ and ATA_CMD_PMP_WRITE constants have been
>> renamed
>> to ATA_CMD_READ_BUFFER and ATA_CMD_WRITE_BUFFER to reflect the actual
>> name of
>> the corresponding ATA command.
>>
>> Signed-off-by: Robert Hancock <hancockrwd@gmail.com>
>
> Any comment on this one, guys?
>
>>
>> diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
>> index 01964b6..dd89f0b 100644
>> --- a/drivers/ata/libata-acpi.c
>> +++ b/drivers/ata/libata-acpi.c
>> @@ -737,7 +737,7 @@ static int ata_acpi_run_tf(struct ata_device *dev,
>> snprintf(msg, sizeof(msg), "filtered out");
>> rc = 0;
>> }
>> - descr = ata_get_cmd_descript(tf.command);
>> + descr = ata_get_cmd_descript(&tf);
>>
>> ata_dev_printk(dev, level,
>> "ACPI cmd %02x/%02x:%02x:%02x:%02x:%02x:%02x (%s) %s\n",
>> diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
>> index a04488f..06c62f1 100644
>> --- a/drivers/ata/libata-eh.c
>> +++ b/drivers/ata/libata-eh.c
>> @@ -2114,109 +2114,200 @@ void ata_eh_autopsy(struct ata_port *ap)
>>
>> /**
>> * ata_get_cmd_descript - get description for ATA command
>> - * @command: ATA command code to get description for
>> + * @tf: ATA taskfile to get description for
>> *
>> - * Return a textual description of the given command, or NULL if the
>> + * Return a textual description of the given taskfile, or NULL if the
>> * command is not known.
>> *
>> * LOCKING:
>> * None
>> */
>> -const char *ata_get_cmd_descript(u8 command)
>> +const char *ata_get_cmd_descript(const struct ata_taskfile* tf)
>> {
>> #ifdef CONFIG_ATA_VERBOSE_ERROR
>> - static const struct
>> - {
>> - u8 command;
>> - const char *text;
>> - } cmd_descr[] = {
>> - { ATA_CMD_DEV_RESET, "DEVICE RESET" },
>> - { ATA_CMD_CHK_POWER, "CHECK POWER MODE" },
...
>> + switch (tf->command) {
>> + case ATA_CMD_CONF_OVERLAY:
>> + switch (tf->feature) {
>> + case ATA_DCO_RESTORE:
>> + return "DEVICE CONFIGURATION RESTORE";
>> + case ATA_DCO_FREEZE_LOCK:
...
>> + case ATA_SET_MAX_ADDR:
>> + return "SET MAX ADDRESS";
I really think that this is begging for a smarter
data structure, with a lot less code as a result.
One should be able to get the overall compiled
size of this down to about half of the current
implementation.
next prev parent reply other threads:[~2009-08-22 14:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 21:27 [PATCH #upstream] libata: enhance command parsing Robert Hancock
2009-08-22 5:57 ` Robert Hancock
2009-08-22 14:02 ` Mark Lord [this message]
[not found] ` <4A8FFA44.30604@rtr.ca>
[not found] ` <51f3faa70908220936w309d9754p4f96cee44d58ea63@mail.gmail.com>
[not found] ` <4A905A4E.5000309@rtr.ca>
2009-08-28 23:55 ` Robert Hancock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A8FFA5B.30209@rtr.ca \
--to=liml@rtr.ca \
--cc=hancockrwd@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.