Skip to content

Commit f4ad7b5

Browse files
James BottomleyJames Bottomley
authored andcommitted
[SCSI] scsi_transport_sas: remove local_attached flag
This flag denotes local attachment of the phy. There are two problems with it: 1) It's actually redundant ... you can get the same information simply by seeing whether a host is the phys parent 2) we condition a lot of phy parameters on it on the false assumption that we can only control local phys. I'm wiring up phy resets in the aic94xx now, and it will be able to reset non-local phys as well. I fixed 2) by moving the local check into the reset and stats function of the mptsas, since that seems to be the only HBA that can't (currently) control non-local phys. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent 8ce7a9c commit f4ad7b5

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

drivers/message/fusion/mptsas.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,10 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
852852
dma_addr_t dma_handle;
853853
int error;
854854

855+
/* FIXME: only have link errors on local phys */
856+
if (!scsi_is_sas_phy_local(phy))
857+
return -EINVAL;
858+
855859
hdr.PageVersion = MPI_SASPHY1_PAGEVERSION;
856860
hdr.ExtPageLength = 0;
857861
hdr.PageNumber = 1 /* page number 1*/;
@@ -924,6 +928,10 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
924928
unsigned long timeleft;
925929
int error = -ERESTARTSYS;
926930

931+
/* FIXME: fusion doesn't allow non-local phy reset */
932+
if (!scsi_is_sas_phy_local(phy))
933+
return -EINVAL;
934+
927935
/* not implemented for expanders */
928936
if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP)
929937
return -ENXIO;
@@ -1570,9 +1578,6 @@ static int mptsas_probe_one_phy(struct device *dev,
15701578

15711579
if (!phy_info->phy) {
15721580

1573-
if (local)
1574-
phy->local_attached = 1;
1575-
15761581
error = sas_phy_add(phy);
15771582
if (error) {
15781583
sas_phy_free(phy);

drivers/scsi/scsi_transport_sas.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,6 @@ show_sas_phy_##field(struct class_device *cdev, char *buf) \
266266
struct sas_internal *i = to_sas_internal(shost->transportt); \
267267
int error; \
268268
\
269-
if (!phy->local_attached) \
270-
return -EINVAL; \
271-
\
272269
error = i->f->get_linkerrors ? i->f->get_linkerrors(phy) : 0; \
273270
if (error) \
274271
return error; \
@@ -299,9 +296,6 @@ static ssize_t do_sas_phy_reset(struct class_device *cdev,
299296
struct sas_internal *i = to_sas_internal(shost->transportt);
300297
int error;
301298

302-
if (!phy->local_attached)
303-
return -EINVAL;
304-
305299
error = i->f->phy_reset(phy, hard_reset);
306300
if (error)
307301
return error;
@@ -849,7 +843,7 @@ show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf)
849843
* Only devices behind an expander are supported, because the
850844
* enclosure identifier is a SMP feature.
851845
*/
852-
if (phy->local_attached)
846+
if (scsi_is_sas_phy_local(phy))
853847
return -EINVAL;
854848

855849
error = i->f->get_enclosure_identifier(rphy, &identifier);
@@ -870,7 +864,7 @@ show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf)
870864
struct sas_internal *i = to_sas_internal(shost->transportt);
871865
int val;
872866

873-
if (phy->local_attached)
867+
if (scsi_is_sas_phy_local(phy))
874868
return -EINVAL;
875869

876870
val = i->f->get_bay_identifier(rphy);

include/scsi/scsi_transport_sas.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ struct sas_phy {
5757
enum sas_linkrate maximum_linkrate_hw;
5858
enum sas_linkrate maximum_linkrate;
5959

60-
/* internal state */
61-
unsigned int local_attached : 1;
62-
6360
/* link error statistics */
6461
u32 invalid_dword_count;
6562
u32 running_disparity_error_count;
@@ -196,4 +193,6 @@ scsi_is_sas_expander_device(struct device *dev)
196193
rphy->identify.device_type == SAS_EDGE_EXPANDER_DEVICE;
197194
}
198195

196+
#define scsi_is_sas_phy_local(phy) scsi_is_host_device((phy)->dev.parent)
197+
199198
#endif /* SCSI_TRANSPORT_SAS_H */

0 commit comments

Comments
 (0)