Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libata-scsi: clean up inquiry / mode sense related functions

* make ata_scsiop_*() static
* make ata_scsi_set_sense() static and move it above its users
* make ata_scsi_rbuf_fill() static
* kill unused ata_scsi_badcmd()

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Tejun Heo and committed by
Jeff Garzik
f0761be3 3dd654bf

+21 -96
+21 -68
drivers/ata/libata-scsi.c
··· 179 179 ata_scsi_lpm_show, ata_scsi_lpm_put); 180 180 EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); 181 181 182 + static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) 183 + { 184 + cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; 185 + 186 + scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); 187 + } 188 + 182 189 static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, 183 190 void (*done)(struct scsi_cmnd *)) 184 191 { ··· 1703 1696 * LOCKING: 1704 1697 * spin_lock_irqsave(host lock) 1705 1698 */ 1706 - 1707 - void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 1708 - unsigned int (*actor) (struct ata_scsi_args *args, 1709 - u8 *rbuf, unsigned int buflen)) 1699 + static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 1700 + unsigned int (*actor)(struct ata_scsi_args *args, 1701 + u8 *rbuf, unsigned int buflen)) 1710 1702 { 1711 1703 u8 *rbuf; 1712 1704 unsigned int buflen, rc; ··· 1754 1748 * LOCKING: 1755 1749 * spin_lock_irqsave(host lock) 1756 1750 */ 1757 - 1758 - unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 1759 - unsigned int buflen) 1751 + static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 1752 + unsigned int buflen) 1760 1753 { 1761 1754 u8 hdr[] = { 1762 1755 TYPE_DISK, ··· 1809 1804 * LOCKING: 1810 1805 * spin_lock_irqsave(host lock) 1811 1806 */ 1812 - 1813 - unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, 1814 - unsigned int buflen) 1807 + static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, 1808 + unsigned int buflen) 1815 1809 { 1816 1810 const u8 pages[] = { 1817 1811 0x00, /* page 0x00, this page */ ··· 1836 1832 * LOCKING: 1837 1833 * spin_lock_irqsave(host lock) 1838 1834 */ 1839 - 1840 - unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, 1841 - unsigned int buflen) 1835 + static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, 1836 + unsigned int buflen) 1842 1837 { 1843 1838 const u8 hdr[] = { 1844 1839 0, ··· 1868 1865 * LOCKING: 1869 1866 * spin_lock_irqsave(host lock) 1870 1867 */ 1871 - 1872 - unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, 1873 - unsigned int buflen) 1868 + static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, 1869 + unsigned int buflen) 1874 1870 { 1875 1871 int num; 1876 1872 const int sat_model_serial_desc_len = 68; ··· 1917 1915 * LOCKING: 1918 1916 * spin_lock_irqsave(host lock) 1919 1917 */ 1920 - 1921 1918 static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, 1922 - unsigned int buflen) 1919 + unsigned int buflen) 1923 1920 { 1924 1921 u8 pbuf[60]; 1925 1922 struct ata_taskfile tf; ··· 1973 1972 * LOCKING: 1974 1973 * spin_lock_irqsave(host lock) 1975 1974 */ 1976 - 1977 - unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, 1978 - unsigned int buflen) 1975 + static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, 1976 + unsigned int buflen) 1979 1977 { 1980 1978 VPRINTK("ENTER\n"); 1981 1979 return 0; ··· 2310 2310 rbuf[3] = 8; /* just one lun, LUN 0, size 8 bytes */ 2311 2311 2312 2312 return 0; 2313 - } 2314 - 2315 - /** 2316 - * ata_scsi_set_sense - Set SCSI sense data and status 2317 - * @cmd: SCSI request to be handled 2318 - * @sk: SCSI-defined sense key 2319 - * @asc: SCSI-defined additional sense code 2320 - * @ascq: SCSI-defined additional sense code qualifier 2321 - * 2322 - * Helper function that builds a valid fixed format, current 2323 - * response code and the given sense key (sk), additional sense 2324 - * code (asc) and additional sense code qualifier (ascq) with 2325 - * a SCSI command status of %SAM_STAT_CHECK_CONDITION and 2326 - * DRIVER_SENSE set in the upper bits of scsi_cmnd::result . 2327 - * 2328 - * LOCKING: 2329 - * Not required 2330 - */ 2331 - 2332 - void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) 2333 - { 2334 - cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; 2335 - 2336 - scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); 2337 - } 2338 - 2339 - /** 2340 - * ata_scsi_badcmd - End a SCSI request with an error 2341 - * @cmd: SCSI request to be handled 2342 - * @done: SCSI command completion function 2343 - * @asc: SCSI-defined additional sense code 2344 - * @ascq: SCSI-defined additional sense code qualifier 2345 - * 2346 - * Helper function that completes a SCSI command with 2347 - * %SAM_STAT_CHECK_CONDITION, with a sense key %ILLEGAL_REQUEST 2348 - * and the specified additional sense codes. 2349 - * 2350 - * LOCKING: 2351 - * spin_lock_irqsave(host lock) 2352 - */ 2353 - 2354 - void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq) 2355 - { 2356 - DPRINTK("ENTER\n"); 2357 - ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, asc, ascq); 2358 - 2359 - done(cmd); 2360 2313 } 2361 2314 2362 2315 static void atapi_sense_complete(struct ata_queued_cmd *qc)
-28
drivers/ata/libata.h
··· 146 146 extern int ata_scsi_offline_dev(struct ata_device *dev); 147 147 extern void ata_scsi_media_change_notify(struct ata_device *dev); 148 148 extern void ata_scsi_hotplug(struct work_struct *work); 149 - extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, 150 - unsigned int buflen); 151 - 152 - extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, 153 - unsigned int buflen); 154 - 155 - extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, 156 - unsigned int buflen); 157 - extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, 158 - unsigned int buflen); 159 - extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, 160 - unsigned int buflen); 161 - extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf, 162 - unsigned int buflen); 163 - extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, 164 - unsigned int buflen); 165 - extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, 166 - unsigned int buflen); 167 - extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, 168 - unsigned int buflen); 169 - extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, 170 - void (*done)(struct scsi_cmnd *), 171 - u8 asc, u8 ascq); 172 - extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, 173 - u8 sk, u8 asc, u8 ascq); 174 - extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, 175 - unsigned int (*actor) (struct ata_scsi_args *args, 176 - u8 *rbuf, unsigned int buflen)); 177 149 extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); 178 150 extern void ata_scsi_dev_rescan(struct work_struct *work); 179 151 extern int ata_bus_probe(struct ata_port *ap);