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

[SCSI] mpt fusion: cleanup eh handlers

nice cosmetic cleaning of eh thread callback funtions

Signed-off-by: Eric Moore <Eric.Moore@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by

Eric Moore and committed by
James Bottomley
958d4a32 4023c474

+78 -56
+78 -56
drivers/message/fusion/mptscsih.c
··· 1727 1727 u32 ctx2abort; 1728 1728 int scpnt_idx; 1729 1729 int retval; 1730 - VirtDevice *vdev; 1730 + VirtDevice *vdevice; 1731 1731 ulong sn = SCpnt->serial_number; 1732 + MPT_ADAPTER *ioc; 1732 1733 1733 1734 /* If we can't locate our host adapter structure, return FAILED status. 1734 1735 */ 1735 1736 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { 1736 1737 SCpnt->result = DID_RESET << 16; 1737 1738 SCpnt->scsi_done(SCpnt); 1738 - dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: " 1739 - "Can't locate host! (sc=%p)\n", 1740 - SCpnt)); 1739 + dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate " 1740 + "host! (sc=%p)\n", SCpnt)); 1741 1741 return FAILED; 1742 + } 1743 + 1744 + ioc = hd->ioc; 1745 + printk(MYIOC_s_INFO_FMT "attempting task abort! (sc=%p)\n", 1746 + ioc->name, SCpnt); 1747 + scsi_print_command(SCpnt); 1748 + 1749 + vdevice = SCpnt->device->hostdata; 1750 + if (!vdevice || !vdevice->vtarget) { 1751 + dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been " 1752 + "deleted (sc=%p)\n", ioc->name, SCpnt)); 1753 + SCpnt->result = DID_NO_CONNECT << 16; 1754 + SCpnt->scsi_done(SCpnt); 1755 + retval = 0; 1756 + goto out; 1742 1757 } 1743 1758 1744 1759 /* Find this command ··· 1764 1749 */ 1765 1750 SCpnt->result = DID_RESET << 16; 1766 1751 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: " 1767 - "Command not in the active list! (sc=%p)\n", 1768 - hd->ioc->name, SCpnt)); 1769 - return SUCCESS; 1752 + "Command not in the active list! (sc=%p)\n", ioc->name, 1753 + SCpnt)); 1754 + retval = 0; 1755 + goto out; 1770 1756 } 1771 1757 1772 - if (hd->resetPending) 1773 - return FAILED; 1758 + if (hd->resetPending) { 1759 + retval = FAILED; 1760 + goto out; 1761 + } 1774 1762 1775 1763 if (hd->timeouts < -1) 1776 1764 hd->timeouts++; 1777 - 1778 - printk(KERN_WARNING MYNAM ": %s: attempting task abort! (sc=%p)\n", 1779 - hd->ioc->name, SCpnt); 1780 - scsi_print_command(SCpnt); 1781 1765 1782 1766 /* Most important! Set TaskMsgContext to SCpnt's MsgContext! 1783 1767 * (the IO to be ABORT'd) ··· 1790 1776 1791 1777 hd->abortSCpnt = SCpnt; 1792 1778 1793 - vdev = SCpnt->device->hostdata; 1794 1779 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK, 1795 - vdev->vtarget->channel, vdev->vtarget->id, vdev->lun, 1796 - ctx2abort, mptscsih_get_tm_timeout(hd->ioc)); 1780 + vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, 1781 + ctx2abort, mptscsih_get_tm_timeout(ioc)); 1797 1782 1798 1783 if (SCPNT_TO_LOOKUP_IDX(SCpnt) == scpnt_idx && 1799 1784 SCpnt->serial_number == sn) 1800 1785 retval = FAILED; 1801 1786 1802 - printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n", 1803 - hd->ioc->name, 1804 - ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1787 + out: 1788 + printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n", 1789 + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1805 1790 1806 1791 if (retval == 0) 1807 1792 return SUCCESS; ··· 1822 1809 { 1823 1810 MPT_SCSI_HOST *hd; 1824 1811 int retval; 1825 - VirtDevice *vdev; 1812 + VirtDevice *vdevice; 1813 + MPT_ADAPTER *ioc; 1826 1814 1827 1815 /* If we can't locate our host adapter structure, return FAILED status. 1828 1816 */ 1829 1817 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1830 - dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: " 1831 - "Can't locate host! (sc=%p)\n", 1832 - SCpnt)); 1818 + dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't " 1819 + "locate host! (sc=%p)\n", SCpnt)); 1833 1820 return FAILED; 1834 1821 } 1835 1822 1836 - if (hd->resetPending) 1837 - return FAILED; 1838 - 1839 - printk(KERN_WARNING MYNAM ": %s: attempting target reset! (sc=%p)\n", 1840 - hd->ioc->name, SCpnt); 1823 + ioc = hd->ioc; 1824 + printk(MYIOC_s_INFO_FMT "attempting target reset! (sc=%p)\n", 1825 + ioc->name, SCpnt); 1841 1826 scsi_print_command(SCpnt); 1842 1827 1843 - vdev = SCpnt->device->hostdata; 1844 - retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1845 - vdev->vtarget->channel, vdev->vtarget->id, 1846 - 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1828 + if (hd->resetPending) { 1829 + retval = FAILED; 1830 + goto out; 1831 + } 1847 1832 1848 - printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n", 1849 - hd->ioc->name, 1850 - ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1833 + vdevice = SCpnt->device->hostdata; 1834 + if (!vdevice || !vdevice->vtarget) { 1835 + retval = 0; 1836 + goto out; 1837 + } 1838 + 1839 + retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 1840 + vdevice->vtarget->channel, vdevice->vtarget->id, 0, 0, 1841 + mptscsih_get_tm_timeout(ioc)); 1842 + 1843 + out: 1844 + printk (MYIOC_s_INFO_FMT "target reset: %s (sc=%p)\n", 1845 + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1851 1846 1852 1847 if (retval == 0) 1853 1848 return SUCCESS; ··· 1879 1858 MPT_SCSI_HOST *hd; 1880 1859 int retval; 1881 1860 VirtDevice *vdev; 1861 + MPT_ADAPTER *ioc; 1882 1862 1883 1863 /* If we can't locate our host adapter structure, return FAILED status. 1884 1864 */ 1885 1865 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1886 - dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: " 1887 - "Can't locate host! (sc=%p)\n", 1888 - SCpnt ) ); 1866 + dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't " 1867 + "locate host! (sc=%p)\n", SCpnt )); 1889 1868 return FAILED; 1890 1869 } 1891 1870 1892 - printk(KERN_WARNING MYNAM ": %s: attempting bus reset! (sc=%p)\n", 1893 - hd->ioc->name, SCpnt); 1871 + ioc = hd->ioc; 1872 + printk(MYIOC_s_INFO_FMT "attempting bus reset! (sc=%p)\n", 1873 + ioc->name, SCpnt); 1894 1874 scsi_print_command(SCpnt); 1895 1875 1896 1876 if (hd->timeouts < -1) ··· 1899 1877 1900 1878 vdev = SCpnt->device->hostdata; 1901 1879 retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS, 1902 - vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(hd->ioc)); 1880 + vdev->vtarget->channel, 0, 0, 0, mptscsih_get_tm_timeout(ioc)); 1903 1881 1904 - printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n", 1905 - hd->ioc->name, 1906 - ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1882 + printk(MYIOC_s_INFO_FMT "bus reset: %s (sc=%p)\n", 1883 + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1907 1884 1908 1885 if (retval == 0) 1909 1886 return SUCCESS; ··· 1923 1902 mptscsih_host_reset(struct scsi_cmnd *SCpnt) 1924 1903 { 1925 1904 MPT_SCSI_HOST * hd; 1926 - int status = SUCCESS; 1905 + int retval; 1906 + MPT_ADAPTER *ioc; 1927 1907 1928 1908 /* If we can't locate the host to reset, then we failed. */ 1929 1909 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1930 - dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1931 - "Can't locate host! (sc=%p)\n", 1932 - SCpnt ) ); 1910 + dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't " 1911 + "locate host! (sc=%p)\n", SCpnt)); 1933 1912 return FAILED; 1934 1913 } 1935 1914 1936 - printk(KERN_WARNING MYNAM ": %s: Attempting host reset! (sc=%p)\n", 1937 - hd->ioc->name, SCpnt); 1915 + ioc = hd->ioc; 1916 + printk(MYIOC_s_INFO_FMT "attempting host reset! (sc=%p)\n", 1917 + ioc->name, SCpnt); 1938 1918 1939 1919 /* If our attempts to reset the host failed, then return a failed 1940 1920 * status. The host will be taken off line by the SCSI mid-layer. 1941 1921 */ 1942 - if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0){ 1943 - status = FAILED; 1922 + if (mpt_HardResetHandler(hd->ioc, CAN_SLEEP) < 0) { 1923 + retval = FAILED; 1944 1924 } else { 1945 1925 /* Make sure TM pending is cleared and TM state is set to 1946 1926 * NONE. 1947 1927 */ 1928 + retval = 0; 1948 1929 hd->tmPending = 0; 1949 1930 hd->tmState = TM_STATE_NONE; 1950 1931 } 1951 1932 1952 - dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: " 1953 - "Status = %s\n", 1954 - (status == SUCCESS) ? "SUCCESS" : "FAILED" ) ); 1933 + printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n", 1934 + ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt); 1955 1935 1956 - return status; 1936 + return retval; 1957 1937 } 1958 1938 1959 1939 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/