From: Greg Freemyer <greg.freemyer@gmail.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>,
Anton Vorontsov <avorontsov@ru.mvista.com>,
linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/12] ahci: Introduce ahci_set_em_messages()
Date: Wed, 3 Mar 2010 09:38:46 -0500 [thread overview]
Message-ID: <87f94c371003030638x4f8a4e13l4145829cb81db33f@mail.gmail.com> (raw)
In-Reply-To: <4B8E4B06.6060405@garzik.org>
On Wed, Mar 3, 2010 at 6:41 AM, Jeff Garzik <jeff@garzik.org> wrote:
> On 03/03/2010 05:40 AM, Sergei Shtylyov wrote:
>>
>> Hello.
>>
>> Jeff Garzik wrote:
>>
>>>>> Factor out some ahci_em_messages handling code from ahci_init_one().
>>>>> We would like to reuse it for non-PCI devices.
>>>>>
>>>>> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
>>>>> ---
>>>>> drivers/ata/ahci.c | 41 ++++++++++++++++++++++++-----------------
>>>>> 1 files changed, 24 insertions(+), 17 deletions(-)
>>>>>
>>>>> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
>>>>> index 18443e9..6694b17 100644
>>>>> --- a/drivers/ata/ahci.c
>>>>> +++ b/drivers/ata/ahci.c
>>>>> @@ -3040,6 +3040,29 @@ static inline void
>>>>> ahci_gtf_filter_workaround(struct ata_host *host)
>>>>> {}
>>>>> #endif
>>>>>
>>>>> +static void ahci_set_em_messages(struct ahci_host_priv *hpriv,
>>>>> + struct ata_port_info *pi)
>>>>> +{
>>>>> + u8 messages;
>>>>> + void __iomem *mmio = hpriv->mmio;
>>>>> + u32 em_loc = readl(mmio + HOST_EM_LOC);
>>>>> + u32 em_ctl = readl(mmio + HOST_EM_CTL);
>>>>> +
>>>>> + if (!ahci_em_messages || !(hpriv->cap & HOST_CAP_EMS))
>>>>> + return;
>>>>> +
>>>>> + messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16;
>>>>> +
>>>>> + /* we only support LED message type right now */
>>>>> + if ((messages & 0x01) && (ahci_em_messages == 1)) {
>>>>> + /* store em_loc */
>>>>> + hpriv->em_loc = ((em_loc >> 16) * 4);
>>>>
>>>> Could drop unneeded parens, while at it...
>>>
>>> While not strictly necessary, parens often help with readability. I
>>> think the above code looks fine as-is. If the reader has to waste a
>>> few seconds recalling C's operator precedence, that detracts from the
>>> easy reading of the code. Not everyone is like me and has worked on a
>>> C compiler, you know ;-)
>>
>> Come on, parens around the right arg of = are pretty counter-intuitive
>> and so don't add to the readability. :-)
>
> <shrug> I respectfully disagree. It is wasteful but does not detract from
> readability at all, IMO.
>
> Jeff
Re: hpriv->em_loc = ((em_loc >> 16) * 4);
I think the way it is leaves the reader wondering what used to be
there. ie. It makes me think there used to be a function call that
was removed, but the parens left in place.
I agree with Sergei that it is a readability issue because it sends
the readers brain off into tangents.
Greg
next prev parent reply other threads:[~2010-03-03 14:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-02 18:28 [PATCH RFC 0/12] ahci: Add support for non-PCI devices Anton Vorontsov
2010-03-02 18:29 ` [PATCH 01/12] ahci: Fix some sparse warnings Anton Vorontsov
2010-03-02 18:29 ` [PATCH 02/12] ahci: Get rid of host->iomap usage Anton Vorontsov
2010-03-02 18:29 ` [PATCH 03/12] ahci: Factor out PCI specifics from ahci_save_initial_config() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 04/12] ahci: Get rid of pci_dev argument in ahci_save_initial_config() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 05/12] ahci: Factor out PCI specifics from ahci_reset_controller() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 06/12] ahci: Get rid of pci_dev argument in ahci_port_init() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 07/12] ahci: Factor out PCI specifics from ahci_init_controller() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 08/12] ahci: Factor out PCI specifics from ahci_print_info() Anton Vorontsov
2010-03-02 18:29 ` [PATCH 09/12] ahci: Introduce ahci_set_em_messages() Anton Vorontsov
2010-03-02 21:18 ` Sergei Shtylyov
2010-03-02 23:19 ` Jeff Garzik
2010-03-03 10:40 ` Sergei Shtylyov
2010-03-03 11:41 ` Jeff Garzik
2010-03-03 14:38 ` Greg Freemyer [this message]
2010-03-02 18:29 ` [PATCH 10/12] ahci: Move PCI code into ahci_pci.c Anton Vorontsov
2010-03-02 18:29 ` [PATCH 11/12] ahci: Export generic AHCI symbols Anton Vorontsov
2010-03-02 18:29 ` [PATCH 12/12] ahci: Add platform driver Anton Vorontsov
2010-03-02 19:41 ` Sergei Shtylyov
2010-03-03 13:14 ` Anton Vorontsov
2010-03-02 21:34 ` [PATCH RFC 0/12] ahci: Add support for non-PCI devices Jeff Garzik
2010-03-03 13:15 ` Anton Vorontsov
2010-03-03 13:40 ` Jeff Garzik
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=87f94c371003030638x4f8a4e13l4145829cb81db33f@mail.gmail.com \
--to=greg.freemyer@gmail.com \
--cc=avorontsov@ru.mvista.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sshtylyov@mvista.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).