diff mbox

[U-Boot,1/2] remove unnecessary code in ata_piix

Message ID 1348823884-17187-1-git-send-email-morpheus.ibis@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Pavel Herrmann Sept. 28, 2012, 9:18 a.m. UTC
We set sata_curr_device to 0 right after returning from init_sata(), so there's
no point in setting it to the last scanned driver at this point.
Note: there are more duplicities with cmd_sata, but those might be required,
as the code seems to reset the entire controller on every scan, ignoring the
requested port number.

Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
---
 drivers/block/ata_piix.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Marek Vasut Sept. 28, 2012, 6:12 p.m. UTC | #1
Dear Pavel Herrmann,

> We set sata_curr_device to 0 right after returning from init_sata(), so
> there's no point in setting it to the last scanned driver at this point.
> Note: there are more duplicities with cmd_sata, but those might be
> required, as the code seems to reset the entire controller on every scan,
> ignoring the requested port number.

I think that code is valid. It configures the sata_curr_device to valid value in 
case this was not called from the context of the command. No?

I think it can be pulled from the loops above the return 0 though.

> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
> ---
>  drivers/block/ata_piix.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/block/ata_piix.c b/drivers/block/ata_piix.c
> index c81d11a..1c3ab8a 100644
> --- a/drivers/block/ata_piix.c
> +++ b/drivers/block/ata_piix.c
> @@ -204,9 +204,6 @@ init_sata (int dev)
>  				dev_print (&sata_dev_desc[devno]);
>  				/* initialize partition type */
>  				init_part (&sata_dev_desc[devno]);
> -				if (sata_curr_device < 0)
> -					sata_curr_device =
> -					    i * CONFIG_SYS_SATA_DEVS_PER_BUS + 
j;
>  			}
>  		}
>  	}

Best regards,
Marek Vasut
Tom Rini Sept. 28, 2012, 6:29 p.m. UTC | #2
On Fri, Sep 28, 2012 at 08:12:21PM +0200, Marek Vasut wrote:

> Dear Pavel Herrmann,
> 
> > We set sata_curr_device to 0 right after returning from init_sata(),
> > so there's no point in setting it to the last scanned driver at this
> > point.  Note: there are more duplicities with cmd_sata, but those
> > might be required, as the code seems to reset the entire controller
> > on every scan, ignoring the requested port number.
> 
> I think that code is valid. It configures the sata_curr_device to
> valid value in case this was not called from the context of the
> command. No?
> 
> I think it can be pulled from the loops above the return 0 though.

Pavel has it right.  A further clean-up would be to make
sata_curr_device be static to common/cmd_sata.c as it's unused /
referenced anywhere else.
Tom Rini Sept. 29, 2012, 2:52 p.m. UTC | #3
On Thu, Sep 27, 2012 at 11:18:03PM -0000, Pavel Herrmann wrote:

> We set sata_curr_device to 0 right after returning from init_sata(), so there's
> no point in setting it to the last scanned driver at this point.
> Note: there are more duplicities with cmd_sata, but those might be required,
> as the code seems to reset the entire controller on every scan, ignoring the
> requested port number.
> 
> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/drivers/block/ata_piix.c b/drivers/block/ata_piix.c
index c81d11a..1c3ab8a 100644
--- a/drivers/block/ata_piix.c
+++ b/drivers/block/ata_piix.c
@@ -204,9 +204,6 @@  init_sata (int dev)
 				dev_print (&sata_dev_desc[devno]);
 				/* initialize partition type */
 				init_part (&sata_dev_desc[devno]);
-				if (sata_curr_device < 0)
-					sata_curr_device =
-					    i * CONFIG_SYS_SATA_DEVS_PER_BUS + j;
 			}
 		}
 	}