diff options
| -rw-r--r-- | drivers/scsi/libata-core.c | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index bbd6665eb212..4a44e759e45a 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
| @@ -1131,14 +1131,23 @@ unsigned ata_exec_internal(struct ata_device *dev, | |||
| 1131 | return err_mask; | 1131 | return err_mask; |
| 1132 | } | 1132 | } |
| 1133 | 1133 | ||
| 1134 | /* | 1134 | /** |
| 1135 | * Execute a 'simple' command, that only consists of the opcode 'cmd' itself, | 1135 | * ata_do_simple_cmd - execute simple internal command |
| 1136 | * without filling any other registers | 1136 | * @dev: Device to which the command is sent |
| 1137 | * @cmd: Opcode to execute | ||
| 1138 | * | ||
| 1139 | * Execute a 'simple' command, that only consists of the opcode | ||
| 1140 | * 'cmd' itself, without filling any other registers | ||
| 1141 | * | ||
| 1142 | * LOCKING: | ||
| 1143 | * Kernel thread context (may sleep). | ||
| 1144 | * | ||
| 1145 | * RETURNS: | ||
| 1146 | * Zero on success, AC_ERR_* mask on failure | ||
| 1137 | */ | 1147 | */ |
| 1138 | static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) | 1148 | static unsigned int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) |
| 1139 | { | 1149 | { |
| 1140 | struct ata_taskfile tf; | 1150 | struct ata_taskfile tf; |
| 1141 | int err; | ||
| 1142 | 1151 | ||
| 1143 | ata_tf_init(dev, &tf); | 1152 | ata_tf_init(dev, &tf); |
| 1144 | 1153 | ||
| @@ -1146,12 +1155,7 @@ static int ata_do_simple_cmd(struct ata_device *dev, u8 cmd) | |||
| 1146 | tf.flags |= ATA_TFLAG_DEVICE; | 1155 | tf.flags |= ATA_TFLAG_DEVICE; |
| 1147 | tf.protocol = ATA_PROT_NODATA; | 1156 | tf.protocol = ATA_PROT_NODATA; |
| 1148 | 1157 | ||
| 1149 | err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); | 1158 | return ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
| 1150 | if (err) | ||
| 1151 | ata_dev_printk(dev, KERN_ERR, "%s: ata command failed: %d\n", | ||
| 1152 | __FUNCTION__, err); | ||
| 1153 | |||
| 1154 | return err; | ||
| 1155 | } | 1159 | } |
| 1156 | 1160 | ||
| 1157 | /** | 1161 | /** |
| @@ -4971,6 +4975,7 @@ int ata_port_offline(struct ata_port *ap) | |||
| 4971 | 4975 | ||
| 4972 | static int ata_flush_cache(struct ata_device *dev) | 4976 | static int ata_flush_cache(struct ata_device *dev) |
| 4973 | { | 4977 | { |
| 4978 | unsigned int err_mask; | ||
| 4974 | u8 cmd; | 4979 | u8 cmd; |
| 4975 | 4980 | ||
| 4976 | if (!ata_try_flush_cache(dev)) | 4981 | if (!ata_try_flush_cache(dev)) |
| @@ -4981,17 +4986,41 @@ static int ata_flush_cache(struct ata_device *dev) | |||
| 4981 | else | 4986 | else |
| 4982 | cmd = ATA_CMD_FLUSH; | 4987 | cmd = ATA_CMD_FLUSH; |
| 4983 | 4988 | ||
| 4984 | return ata_do_simple_cmd(dev, cmd); | 4989 | err_mask = ata_do_simple_cmd(dev, cmd); |
| 4990 | if (err_mask) { | ||
| 4991 | ata_dev_printk(dev, KERN_ERR, "failed to flush cache\n"); | ||
| 4992 | return -EIO; | ||
| 4993 | } | ||
| 4994 | |||
| 4995 | return 0; | ||
| 4985 | } | 4996 | } |
| 4986 | 4997 | ||
| 4987 | static int ata_standby_drive(struct ata_device *dev) | 4998 | static int ata_standby_drive(struct ata_device *dev) |
| 4988 | { | 4999 | { |
| 4989 | return ata_do_simple_cmd(dev, ATA_CMD_STANDBYNOW1); | 5000 | unsigned int err_mask; |
| 5001 | |||
| 5002 | err_mask = ata_do_simple_cmd(dev, ATA_CMD_STANDBYNOW1); | ||
| 5003 | if (err_mask) { | ||
| 5004 | ata_dev_printk(dev, KERN_ERR, "failed to standby drive " | ||
| 5005 | "(err_mask=0x%x)\n", err_mask); | ||
| 5006 | return -EIO; | ||
| 5007 | } | ||
| 5008 | |||
| 5009 | return 0; | ||
| 4990 | } | 5010 | } |
| 4991 | 5011 | ||
| 4992 | static int ata_start_drive(struct ata_device *dev) | 5012 | static int ata_start_drive(struct ata_device *dev) |
| 4993 | { | 5013 | { |
| 4994 | return ata_do_simple_cmd(dev, ATA_CMD_IDLEIMMEDIATE); | 5014 | unsigned int err_mask; |
| 5015 | |||
| 5016 | err_mask = ata_do_simple_cmd(dev, ATA_CMD_IDLEIMMEDIATE); | ||
| 5017 | if (err_mask) { | ||
| 5018 | ata_dev_printk(dev, KERN_ERR, "failed to start drive " | ||
| 5019 | "(err_mask=0x%x)\n", err_mask); | ||
| 5020 | return -EIO; | ||
| 5021 | } | ||
| 5022 | |||
| 5023 | return 0; | ||
| 4995 | } | 5024 | } |
| 4996 | 5025 | ||
| 4997 | /** | 5026 | /** |
