Re: [PATCH 1/2] pata_sis: extract a sis_port_base() method

From: Dan McGee
Date: Wed Sep 07 2011 - 12:03:10 EST


On Wed, Sep 7, 2011 at 4:58 AM, Sergei Shtylyov <sshtylyov@xxxxxxxxxx> wrote:
> Hello.
>
> On 06-09-2011 23:21, Dan McGee wrote:
>
>> This is similar to the existing sis_old_port_base() method. We do this
>> same calculation and logic in multiple places (with one more to come in
>> a future patch), so extracting it into a method makes sense.
>
>> Reviewed-by: Bartlomiej Zolnierkiewicz<bzolnier@xxxxxxxxx>
>> Signed-off-by: Dan McGee<dpmcgee@xxxxxxxxx>
>> ---
>> Âdrivers/ata/pata_sis.c | Â 46
>> ++++++++++++++++++++++++++++------------------
>> Â1 files changed, 28 insertions(+), 18 deletions(-)
>
>> diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
>> index 533f2ae..9374400 100644
>> --- a/drivers/ata/pata_sis.c
>> +++ b/drivers/ata/pata_sis.c
>> @@ -89,6 +89,29 @@ static int sis_old_port_base(struct ata_device *adev)
>> + Â Â Â /* If bit 14 is set then the registers are mapped at 0x70 not 0x40
>> */
>> + Â Â Â pci_read_config_dword(pdev, 0x54,&reg54);
>> + Â Â Â if (reg54 & 0x40000000)
>
> Â This is bit 30, not bit 14.
You've snipped the rest of the patch where I simply cut this comment
from the three other places it was stated. I'm simply moving code and
text around here. I will update the apparently erroneous comment.

>
>> + Â Â Â Â Â Â Â port = 0x70;
>> +
>> + Â Â Â return Âport + (8 * ap->port_no) + Â(4 * adev->devno);
>
> Â Why two spaces at some places?
It is from the odd style of the method right above it. This driver has
a lot of odd styling. I'll "fix" it.

>
> [...]
>>
>> @@ -465,21 +482,14 @@ static void sis_133_early_set_dmamode (struct
>> ata_port *ap, struct ata_device *a
>> Âstatic void sis_133_set_dmamode (struct ata_port *ap, struct ata_device
>> *adev)
>> Â{
>>    Âstruct pci_dev *pdev  Â= to_pci_dev(ap->host->dev);
>> - Â Â Â int speed = adev->dma_mode - XFER_MW_DMA_0;
>
> Â Unrelated change.
In context this change makes perfect sense- I'm cleaning up the rest
of the locals after extracting the method, and this one is out of
place and a totally dead assignment.

>
> [...]
>>
>> @@ -487,7 +497,7 @@ static void sis_133_set_dmamode (struct ata_port *ap,
>> struct ata_device *adev)
>> Â Â Â Â Â Â Â Â/* FIXME: need data sheet to add MWDMA here. Also lacking
>> on
>> Â Â Â Â Â Â Â Â Â ide/pci driver */
>> Â Â Â Â} else {
>> - Â Â Â Â Â Â Â speed = adev->dma_mode - XFER_UDMA_0;
>> + Â Â Â Â Â Â Â int speed = adev->dma_mode - XFER_UDMA_0;
>
> Â Same here.
>
> WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/