Re: [PATCH 1/1] AVR32 PATA driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 +static int pata_at32_get_pio_mask(void)
> +{
> +	switch (max_pio) {
> +	case 0:
> +		return 0x01;
> +	case 1:
> +		return 0x03;
> +	case 2:
> +		return 0x07;
> +	case 3:
> +		return 0x0f;
> +	case 4:
> +		return 0x1f;
> +	default:
> +		return 0x01;


What is wrong with just using  (1 << max_pio) - 1 as the range is only
0-4 anyway.

> +static void pata_at32_data_xfer(struct ata_device *adev, unsigned char *buf,
> +				unsigned int buflen, int write_data)
> +{
> +	struct at32_ide_info *info = adev->ap->host->private_data;
> +
> +	/* Set SMC to data transfer speed */
> +	if (info->smc_pio_mode < 3)
> +		smc_restore_registers(info->cs, &info->smc_16.reg);
> +
> +	/* Transfer data */
> +	ata_data_xfer(adev, buf, buflen, write_data);
> +
> +	/* Set SMC back to register transfer speed */
> +	if (info->smc_pio_mode < 3)
> +		smc_restore_registers(info->cs, &info->smc_8.reg);

Should be safe currently for IRQ driven behaviour, might be for polled but
remember that without locking you could end up reading the status before
you switch the clock back  so I'm not 100% sure.


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux