]> err.no Git - linux-2.6/blobdiff - include/linux/libata.h
proc: introduce proc_create_data to setup de->data
[linux-2.6] / include / linux / libata.h
index eb86d6f396354ce23587a876f81a9c76f5589d3e..395a523d8c30c157985a48789016efea659c1196 100644 (file)
@@ -443,7 +443,7 @@ enum link_pm {
        MAX_PERFORMANCE,
        MEDIUM_POWER,
 };
-extern struct class_device_attribute class_device_attr_link_power_management_policy;
+extern struct device_attribute dev_attr_link_power_management_policy;
 
 #ifdef CONFIG_ATA_SFF
 struct ata_ioports {
@@ -847,7 +847,6 @@ static inline int ata_port_is_dummy(struct ata_port *ap)
        return ap->ops == &ata_dummy_port_ops;
 }
 
-extern void sata_print_link_status(struct ata_link *link);
 extern void ata_port_probe(struct ata_port *);
 extern int sata_set_spd(struct ata_link *link);
 extern int ata_std_prereset(struct ata_link *link, unsigned long deadline);
@@ -1089,6 +1088,48 @@ extern const struct ata_port_operations sata_port_ops;
        ATA_BASE_SHT(drv_name),                                 \
        .change_queue_depth     = ata_scsi_change_queue_depth
 
+/*
+ * PMP helpers
+ */
+#ifdef CONFIG_SATA_PMP
+static inline bool sata_pmp_supported(struct ata_port *ap)
+{
+       return ap->flags & ATA_FLAG_PMP;
+}
+
+static inline bool sata_pmp_attached(struct ata_port *ap)
+{
+       return ap->nr_pmp_links != 0;
+}
+
+static inline int ata_is_host_link(const struct ata_link *link)
+{
+       return link == &link->ap->link;
+}
+#else /* CONFIG_SATA_PMP */
+static inline bool sata_pmp_supported(struct ata_port *ap)
+{
+       return false;
+}
+
+static inline bool sata_pmp_attached(struct ata_port *ap)
+{
+       return false;
+}
+
+static inline int ata_is_host_link(const struct ata_link *link)
+{
+       return 1;
+}
+#endif /* CONFIG_SATA_PMP */
+
+static inline int sata_srst_pmp(struct ata_link *link)
+{
+       if (sata_pmp_supported(link->ap) && ata_is_host_link(link))
+               return SATA_PMP_CTRL_PORT;
+       return link->pmp;
+}
+
 /*
  * printk helpers
  */
@@ -1096,7 +1137,7 @@ extern const struct ata_port_operations sata_port_ops;
        printk("%sata%u: "fmt, lv, (ap)->print_id , ##args)
 
 #define ata_link_printk(link, lv, fmt, args...) do { \
-       if ((link)->ap->nr_pmp_links) \
+       if (sata_pmp_attached((link)->ap)) \
                printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                       (link)->pmp , ##args); \
        else \
@@ -1182,11 +1223,6 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev)
 /*
  * link helpers
  */
-static inline int ata_is_host_link(const struct ata_link *link)
-{
-       return link == &link->ap->link;
-}
-
 static inline int ata_link_max_devices(const struct ata_link *link)
 {
        if (ata_is_host_link(link) && link->ap->flags & ATA_FLAG_SLAVE_POSS)
@@ -1201,7 +1237,7 @@ static inline int ata_link_active(struct ata_link *link)
 
 static inline struct ata_link *ata_port_first_link(struct ata_port *ap)
 {
-       if (ap->nr_pmp_links)
+       if (sata_pmp_attached(ap))
                return ap->pmp_link;
        return &ap->link;
 }
@@ -1210,8 +1246,8 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
 {
        struct ata_port *ap = link->ap;
 
-       if (link == &ap->link) {
-               if (!ap->nr_pmp_links)
+       if (ata_is_host_link(link)) {
+               if (!sata_pmp_attached(ap))
                        return NULL;
                return ap->pmp_link;
        }
@@ -1349,11 +1385,21 @@ static inline struct ata_port *ata_shost_to_port(struct Scsi_Host *host)
 /**************************************************************************
  * PMP - drivers/ata/libata-pmp.c
  */
+#ifdef CONFIG_SATA_PMP
+
 extern const struct ata_port_operations sata_pmp_port_ops;
 
 extern int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc);
 extern void sata_pmp_error_handler(struct ata_port *ap);
 
+#else /* CONFIG_SATA_PMP */
+
+#define sata_pmp_port_ops              sata_port_ops
+#define sata_pmp_qc_defer_cmd_switch   ata_std_qc_defer
+#define sata_pmp_error_handler         ata_std_error_handler
+
+#endif /* CONFIG_SATA_PMP */
+
 
 /**************************************************************************
  * SFF - drivers/ata/libata-sff.c