• Home
  • Raw
  • Download

Lines Matching +full:ac +full:- +full:link

1 // SPDX-License-Identifier: GPL-2.0-only
10 * interfaces to user-space.
13 * - ata_port
14 * - ata_link
15 * - ata_device
16 * Each port has a link object. Each link can have up to two devices for PATA
38 #include "libata-transport.h"
71 tdev_to_device((dev)->parent)
76 tdev_to_link((dev)->parent)
81 tdev_to_port((dev)->parent)
84 /* Device objects are always created whit link objects */
211 return scnprintf(buf, 20, format_string, cast ap->field); \
228 ata_host_put(ap->host); in ata_tport_release()
232 * ata_is_port -- check if a struct device represents a ATA port
240 return dev->release == ata_tport_release; in ata_is_port()
248 return &ata_scsi_transport_template->host_attrs.ac == cont; in ata_tport_match()
252 * ata_tport_delete -- remove ATA PORT
255 * Removes the specified ATA PORT. Remove the associated link as well.
259 struct device *dev = &ap->tdev; in ata_tport_delete()
261 ata_tlink_delete(&ap->link); in ata_tport_delete()
273 /** ata_tport_add - initialize a transport ATA port structure
287 struct device *dev = &ap->tdev; in ata_tport_add()
290 if (ap->flags & ATA_FLAG_SAS_HOST) in ata_tport_add()
291 dev->type = &ata_port_sas_type; in ata_tport_add()
293 dev->type = &ata_port_type; in ata_tport_add()
295 dev->parent = parent; in ata_tport_add()
296 ata_host_get(ap->host); in ata_tport_add()
297 dev->release = ata_tport_release; in ata_tport_add()
298 dev_set_name(dev, "ata%d", ap->print_id); in ata_tport_add()
316 error = ata_tlink_add(&ap->link); in ata_tport_add()
335 * ATA link attributes
344 struct ata_link *link = transport_class_to_link(dev); \
346 return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \
366 * ata_is_link -- check if a struct device represents a ATA link
370 * %1 if the device represents a ATA link, %0 else
374 return dev->release == ata_tlink_release; in ata_is_link()
383 return &i->link_attr_cont.ac == cont; in ata_tlink_match()
387 * ata_tlink_delete -- remove ATA LINK
388 * @port: ATA LINK to remove
390 * Removes the specified ATA LINK. remove associated ATA device(s) as well.
392 void ata_tlink_delete(struct ata_link *link) in ata_tlink_delete() argument
394 struct device *dev = &link->tdev; in ata_tlink_delete()
397 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_delete()
408 * ata_tlink_add -- initialize a transport ATA link structure
409 * @link: allocated ata_link structure.
411 * Initialize an ATA LINK structure for sysfs. It will be added in the
416 int ata_tlink_add(struct ata_link *link) in ata_tlink_add() argument
418 struct device *dev = &link->tdev; in ata_tlink_add()
419 struct ata_port *ap = link->ap; in ata_tlink_add()
424 dev->parent = &ap->tdev; in ata_tlink_add()
425 dev->release = ata_tlink_release; in ata_tlink_add()
426 if (ata_is_host_link(link)) in ata_tlink_add()
427 dev_set_name(dev, "link%d", ap->print_id); in ata_tlink_add()
429 dev_set_name(dev, "link%d.%d", ap->print_id, link->pmp); in ata_tlink_add()
443 ata_for_each_dev(ata_dev, link, ALL) { in ata_tlink_add()
451 while (--ata_dev >= link->device) { in ata_tlink_add()
474 return get_ata_##title##_names(ata_dev->field, buf); \
494 return scnprintf(buf, 20, format_string, cast ata_dev->field); \
515 seconds = div_u64_rem(ent->timestamp, HZ, &rem); in ata_show_ering()
516 arg->written += sprintf(arg->buf + arg->written, in ata_show_ering()
519 arg->written += get_ata_err_names(ent->err_mask, in ata_show_ering()
520 arg->buf + arg->written); in ata_show_ering()
531 ata_ering_map(&ata_dev->ering, ata_show_ering, &arg); in show_ata_dev_ering()
545 if (ata_dev->class == ATA_DEV_PMP) in show_ata_dev_id()
549 ata_dev->id[i], in show_ata_dev_id()
564 if (ata_dev->class != ATA_DEV_PMP) in show_ata_dev_gscr()
568 ata_dev->gscr[i], in show_ata_dev_gscr()
572 buf[written-1] = '\n'; in show_ata_dev_gscr()
585 if (!ata_id_has_trim(ata_dev->id)) in show_ata_dev_trim()
587 else if (ata_dev->horkage & ATA_HORKAGE_NOTRIM) in show_ata_dev_trim()
589 else if (ata_dev->horkage & ATA_HORKAGE_NO_NCQ_TRIM) in show_ata_dev_trim()
609 * ata_is_ata_dev -- check if a struct device represents a ATA device
617 return dev->release == ata_tdev_release; in ata_is_ata_dev()
626 return &i->dev_attr_cont.ac == cont; in ata_tdev_match()
630 * ata_tdev_free -- free a ATA LINK
641 transport_destroy_device(&dev->tdev); in ata_tdev_free()
642 put_device(&dev->tdev); in ata_tdev_free()
646 * ata_tdev_delete -- remove ATA device
653 struct device *dev = &ata_dev->tdev; in ata_tdev_delete()
662 * ata_tdev_add -- initialize a transport ATA device structure.
666 * device tree below the ATA LINK device it belongs to.
672 struct device *dev = &ata_dev->tdev; in ata_tdev_add()
673 struct ata_link *link = ata_dev->link; in ata_tdev_add() local
674 struct ata_port *ap = link->ap; in ata_tdev_add()
678 dev->parent = &link->tdev; in ata_tdev_add()
679 dev->release = ata_tdev_release; in ata_tdev_add()
680 if (ata_is_host_link(link)) in ata_tdev_add()
681 dev_set_name(dev, "dev%d.%d", ap->print_id,ata_dev->devno); in ata_tdev_add()
683 dev_set_name(dev, "dev%d.%d.0", ap->print_id, link->pmp); in ata_tdev_add()
710 i->private_##attrb[count] = dev_attr_##field; \
711 i->private_##attrb[count].attr.mode = perm; \
712 i->attrb[count] = &i->private_##attrb[count]; \
726 * ata_attach_transport -- instantiate ATA transport template
737 i->t.eh_strategy_handler = ata_scsi_error; in ata_attach_transport()
738 i->t.user_scan = ata_scsi_user_scan; in ata_attach_transport()
740 i->t.host_attrs.ac.attrs = &i->port_attrs[0]; in ata_attach_transport()
741 i->t.host_attrs.ac.class = &ata_port_class.class; in ata_attach_transport()
742 i->t.host_attrs.ac.match = ata_tport_match; in ata_attach_transport()
743 transport_container_register(&i->t.host_attrs); in ata_attach_transport()
745 i->link_attr_cont.ac.class = &ata_link_class.class; in ata_attach_transport()
746 i->link_attr_cont.ac.attrs = &i->link_attrs[0]; in ata_attach_transport()
747 i->link_attr_cont.ac.match = ata_tlink_match; in ata_attach_transport()
748 transport_container_register(&i->link_attr_cont); in ata_attach_transport()
750 i->dev_attr_cont.ac.class = &ata_dev_class.class; in ata_attach_transport()
751 i->dev_attr_cont.ac.attrs = &i->dev_attrs[0]; in ata_attach_transport()
752 i->dev_attr_cont.ac.match = ata_tdev_match; in ata_attach_transport()
753 transport_container_register(&i->dev_attr_cont); in ata_attach_transport()
760 i->port_attrs[count] = NULL; in ata_attach_transport()
767 i->link_attrs[count] = NULL; in ata_attach_transport()
780 i->dev_attrs[count] = NULL; in ata_attach_transport()
782 return &i->t; in ata_attach_transport()
786 * ata_release_transport -- release ATA transport template instance
793 transport_container_unregister(&i->t.host_attrs); in ata_release_transport()
794 transport_container_unregister(&i->link_attr_cont); in ata_release_transport()
795 transport_container_unregister(&i->dev_attr_cont); in ata_release_transport()