Lines Matching refs:phy
458 struct sas_phy *phy = transport_class_to_phy(dev); \
460 return snprintf(buf, 20, format_string, cast phy->field); \
472 struct sas_phy *phy = transport_class_to_phy(dev); \
474 if (!phy->field) \
476 return get_sas_protocol_names(phy->field, buf); \
488 struct sas_phy *phy = transport_class_to_phy(dev); \
490 return get_sas_linkspeed_names(phy->field, buf); \
500 struct sas_phy *phy = transport_class_to_phy(dev); \
501 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \
511 error = i->f->set_phy_speed(phy, &rates); \
532 struct sas_phy *phy = transport_class_to_phy(dev); \
533 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); \
537 error = i->f->get_linkerrors ? i->f->get_linkerrors(phy) : 0; \
540 return snprintf(buf, 20, "%u\n", phy->field); \
552 struct sas_phy *phy = transport_class_to_phy(dev); in show_sas_device_type() local
554 if (!phy->identify.device_type) in show_sas_device_type()
556 return get_sas_device_type_names(phy->identify.device_type, buf); in show_sas_device_type()
563 struct sas_phy *phy = transport_class_to_phy(dev); in do_sas_phy_enable() local
564 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in do_sas_phy_enable()
568 error = i->f->phy_enable(phy, enable); in do_sas_phy_enable()
571 phy->enabled = enable; in do_sas_phy_enable()
600 struct sas_phy *phy = transport_class_to_phy(dev); in show_sas_phy_enable() local
602 return snprintf(buf, 20, "%d", phy->enabled); in show_sas_phy_enable()
611 struct sas_phy *phy = transport_class_to_phy(dev); in do_sas_phy_reset() local
612 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in do_sas_phy_reset()
616 error = i->f->phy_reset(phy, hard_reset); in do_sas_phy_reset()
619 phy->enabled = 1; in do_sas_phy_reset()
660 struct sas_phy *phy = dev_to_phy(dev); in sas_phy_setup() local
661 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in sas_phy_setup()
665 i->f->phy_setup(phy); in sas_phy_setup()
694 struct sas_phy *phy = dev_to_phy(dev); in sas_phy_release() local
695 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in sas_phy_release()
699 i->f->phy_release(phy); in sas_phy_release()
701 kfree(phy); in sas_phy_release()
719 struct sas_phy *phy; in sas_phy_alloc() local
721 phy = kzalloc(sizeof(*phy), GFP_KERNEL); in sas_phy_alloc()
722 if (!phy) in sas_phy_alloc()
725 phy->number = number; in sas_phy_alloc()
726 phy->enabled = 1; in sas_phy_alloc()
728 device_initialize(&phy->dev); in sas_phy_alloc()
729 phy->dev.parent = get_device(parent); in sas_phy_alloc()
730 phy->dev.release = sas_phy_release; in sas_phy_alloc()
731 INIT_LIST_HEAD(&phy->port_siblings); in sas_phy_alloc()
734 dev_set_name(&phy->dev, "phy-%d:%d:%d", shost->host_no, in sas_phy_alloc()
737 dev_set_name(&phy->dev, "phy-%d:%d", shost->host_no, number); in sas_phy_alloc()
739 transport_setup_device(&phy->dev); in sas_phy_alloc()
741 return phy; in sas_phy_alloc()
751 int sas_phy_add(struct sas_phy *phy) in sas_phy_add() argument
755 error = device_add(&phy->dev); in sas_phy_add()
757 transport_add_device(&phy->dev); in sas_phy_add()
758 transport_configure_device(&phy->dev); in sas_phy_add()
775 void sas_phy_free(struct sas_phy *phy) in sas_phy_free() argument
777 transport_destroy_device(&phy->dev); in sas_phy_free()
778 put_device(&phy->dev); in sas_phy_free()
790 sas_phy_delete(struct sas_phy *phy) in sas_phy_delete() argument
792 struct device *dev = &phy->dev; in sas_phy_delete()
795 BUG_ON(!list_empty(&phy->port_siblings)); in sas_phy_delete()
870 struct sas_phy *phy) in sas_port_create_link() argument
874 res = sysfs_create_link(&port->dev.kobj, &phy->dev.kobj, in sas_port_create_link()
875 dev_name(&phy->dev)); in sas_port_create_link()
878 res = sysfs_create_link(&phy->dev.kobj, &port->dev.kobj, "port"); in sas_port_create_link()
888 struct sas_phy *phy) in sas_port_delete_link() argument
890 sysfs_remove_link(&port->dev.kobj, dev_name(&phy->dev)); in sas_port_delete_link()
891 sysfs_remove_link(&phy->dev.kobj, "port"); in sas_port_delete_link()
1022 struct sas_phy *phy, *tmp_phy; in sas_port_delete() local
1030 list_for_each_entry_safe(phy, tmp_phy, &port->phy_list, in sas_port_delete()
1032 sas_port_delete_link(port, phy); in sas_port_delete()
1033 list_del_init(&phy->port_siblings); in sas_port_delete()
1070 struct sas_phy *phy; in sas_port_get_phy() local
1074 phy = NULL; in sas_port_get_phy()
1078 phy = list_entry(ent, typeof(*phy), port_siblings); in sas_port_get_phy()
1079 get_device(&phy->dev); in sas_port_get_phy()
1083 return phy; in sas_port_get_phy()
1099 void sas_port_add_phy(struct sas_port *port, struct sas_phy *phy) in sas_port_add_phy() argument
1102 if (unlikely(!list_empty(&phy->port_siblings))) { in sas_port_add_phy()
1107 if (tmp == phy) in sas_port_add_phy()
1111 if (unlikely(tmp != phy)) { in sas_port_add_phy()
1113 dev_name(&phy->dev)); in sas_port_add_phy()
1117 sas_port_create_link(port, phy); in sas_port_add_phy()
1118 list_add_tail(&phy->port_siblings, &port->phy_list); in sas_port_add_phy()
1133 void sas_port_delete_phy(struct sas_port *port, struct sas_phy *phy) in sas_port_delete_phy() argument
1136 sas_port_delete_link(port, phy); in sas_port_delete_phy()
1137 list_del_init(&phy->port_siblings); in sas_port_delete_phy()
1219 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_enclosure_identifier() local
1220 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in show_sas_rphy_enclosure_identifier()
1229 if (scsi_is_sas_phy_local(phy)) in show_sas_rphy_enclosure_identifier()
1246 struct sas_phy *phy = dev_to_phy(rphy->dev.parent); in show_sas_rphy_bay_identifier() local
1247 struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); in show_sas_rphy_bay_identifier()
1251 if (scsi_is_sas_phy_local(phy)) in show_sas_rphy_bay_identifier()