SCSI: convert struct class_device to struct device
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
56d110e852
commit
ee959b00c3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* class_container.h - a generic container for all classes
|
||||
* attribute_container.h - a generic container for all classes
|
||||
*
|
||||
* Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
|
||||
*
|
||||
@@ -18,7 +18,7 @@ struct attribute_container {
|
||||
struct klist containers;
|
||||
struct class *class;
|
||||
struct attribute_group *grp;
|
||||
struct class_device_attribute **attrs;
|
||||
struct device_attribute **attrs;
|
||||
int (*match)(struct attribute_container *, struct device *);
|
||||
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
|
||||
unsigned long flags;
|
||||
@@ -41,31 +41,31 @@ int __must_check attribute_container_unregister(struct attribute_container *cont
|
||||
void attribute_container_create_device(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
struct device *));
|
||||
void attribute_container_add_device(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
struct device *));
|
||||
void attribute_container_remove_device(struct device *dev,
|
||||
void (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
struct device *));
|
||||
void attribute_container_device_trigger(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
struct device *));
|
||||
void attribute_container_trigger(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *));
|
||||
int attribute_container_add_attrs(struct class_device *classdev);
|
||||
int attribute_container_add_class_device(struct class_device *classdev);
|
||||
int attribute_container_add_attrs(struct device *classdev);
|
||||
int attribute_container_add_class_device(struct device *classdev);
|
||||
int attribute_container_add_class_device_adapter(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev);
|
||||
void attribute_container_remove_attrs(struct class_device *classdev);
|
||||
void attribute_container_class_device_del(struct class_device *classdev);
|
||||
struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
|
||||
struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
|
||||
struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
|
||||
struct device *classdev);
|
||||
void attribute_container_remove_attrs(struct device *classdev);
|
||||
void attribute_container_class_device_del(struct device *classdev);
|
||||
struct attribute_container *attribute_container_classdev_to_container(struct device *);
|
||||
struct device *attribute_container_find_class_device(struct attribute_container *, struct device *);
|
||||
struct device_attribute **attribute_container_classdev_to_attrs(const struct device *classdev);
|
||||
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ struct sg_io_v4 {
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_BSG)
|
||||
struct bsg_class_device {
|
||||
struct class_device *class_dev;
|
||||
struct device *class_dev;
|
||||
struct device *dev;
|
||||
int minor;
|
||||
struct request_queue *queue;
|
||||
|
||||
@@ -82,7 +82,8 @@ struct enclosure_component_callbacks {
|
||||
|
||||
struct enclosure_component {
|
||||
void *scratch;
|
||||
struct class_device cdev;
|
||||
struct device cdev;
|
||||
struct device *dev;
|
||||
enum enclosure_component_type type;
|
||||
int number;
|
||||
int fault;
|
||||
@@ -94,20 +95,20 @@ struct enclosure_component {
|
||||
struct enclosure_device {
|
||||
void *scratch;
|
||||
struct list_head node;
|
||||
struct class_device cdev;
|
||||
struct device edev;
|
||||
struct enclosure_component_callbacks *cb;
|
||||
int components;
|
||||
struct enclosure_component component[0];
|
||||
};
|
||||
|
||||
static inline struct enclosure_device *
|
||||
to_enclosure_device(struct class_device *dev)
|
||||
to_enclosure_device(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct enclosure_device, cdev);
|
||||
return container_of(dev, struct enclosure_device, edev);
|
||||
}
|
||||
|
||||
static inline struct enclosure_component *
|
||||
to_enclosure_component(struct class_device *dev)
|
||||
to_enclosure_component(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct enclosure_component, cdev);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -53,20 +53,20 @@ struct raid_data {
|
||||
#define DEFINE_RAID_ATTRIBUTE(type, attr) \
|
||||
static inline void \
|
||||
raid_set_##attr(struct raid_template *r, struct device *dev, type value) { \
|
||||
struct class_device *cdev = \
|
||||
struct device *device = \
|
||||
attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
|
||||
struct raid_data *rd; \
|
||||
BUG_ON(!cdev); \
|
||||
rd = class_get_devdata(cdev); \
|
||||
BUG_ON(!device); \
|
||||
rd = dev_get_drvdata(device); \
|
||||
rd->attr = value; \
|
||||
} \
|
||||
static inline type \
|
||||
raid_get_##attr(struct raid_template *r, struct device *dev) { \
|
||||
struct class_device *cdev = \
|
||||
struct device *device = \
|
||||
attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
|
||||
struct raid_data *rd; \
|
||||
BUG_ON(!cdev); \
|
||||
rd = class_get_devdata(cdev); \
|
||||
BUG_ON(!device); \
|
||||
rd = dev_get_drvdata(device); \
|
||||
return rd->attr; \
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ struct transport_container;
|
||||
struct transport_class {
|
||||
struct class class;
|
||||
int (*setup)(struct transport_container *, struct device *,
|
||||
struct class_device *);
|
||||
struct device *);
|
||||
int (*configure)(struct transport_container *, struct device *,
|
||||
struct class_device *);
|
||||
struct device *);
|
||||
int (*remove)(struct transport_container *, struct device *,
|
||||
struct class_device *);
|
||||
struct device *);
|
||||
};
|
||||
|
||||
#define DECLARE_TRANSPORT_CLASS(cls, nm, su, rm, cfg) \
|
||||
|
||||
@@ -156,8 +156,8 @@ struct scsi_device {
|
||||
|
||||
int timeout;
|
||||
|
||||
struct device sdev_gendev;
|
||||
struct class_device sdev_classdev;
|
||||
struct device sdev_gendev,
|
||||
sdev_dev;
|
||||
|
||||
struct execute_work ew; /* used to get process context on put */
|
||||
|
||||
@@ -167,9 +167,9 @@ struct scsi_device {
|
||||
#define to_scsi_device(d) \
|
||||
container_of(d, struct scsi_device, sdev_gendev)
|
||||
#define class_to_sdev(d) \
|
||||
container_of(d, struct scsi_device, sdev_classdev)
|
||||
container_of(d, struct scsi_device, sdev_dev)
|
||||
#define transport_class_to_sdev(class_dev) \
|
||||
to_scsi_device(class_dev->dev)
|
||||
to_scsi_device(class_dev->parent)
|
||||
|
||||
#define sdev_printk(prefix, sdev, fmt, a...) \
|
||||
dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
|
||||
@@ -220,7 +220,7 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
|
||||
return to_scsi_target(sdev->sdev_gendev.parent);
|
||||
}
|
||||
#define transport_class_to_starget(class_dev) \
|
||||
to_scsi_target(class_dev->dev)
|
||||
to_scsi_target(class_dev->parent)
|
||||
|
||||
#define starget_printk(prefix, starget, fmt, a...) \
|
||||
dev_printk(prefix, &(starget)->dev, fmt, ##a)
|
||||
|
||||
@@ -470,7 +470,7 @@ struct scsi_host_template {
|
||||
/*
|
||||
* Pointer to the sysfs class properties for this host, NULL terminated.
|
||||
*/
|
||||
struct class_device_attribute **shost_attrs;
|
||||
struct device_attribute **shost_attrs;
|
||||
|
||||
/*
|
||||
* Pointer to the SCSI device properties for this host, NULL terminated.
|
||||
@@ -655,8 +655,7 @@ struct Scsi_Host {
|
||||
enum scsi_host_state shost_state;
|
||||
|
||||
/* ldm bits */
|
||||
struct device shost_gendev;
|
||||
struct class_device shost_classdev;
|
||||
struct device shost_gendev, shost_dev;
|
||||
|
||||
/*
|
||||
* List of hosts per template.
|
||||
@@ -683,7 +682,7 @@ struct Scsi_Host {
|
||||
};
|
||||
|
||||
#define class_to_shost(d) \
|
||||
container_of(d, struct Scsi_Host, shost_classdev)
|
||||
container_of(d, struct Scsi_Host, shost_dev)
|
||||
|
||||
#define shost_printk(prefix, shost, fmt, a...) \
|
||||
dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
|
||||
|
||||
@@ -80,7 +80,7 @@ struct scsi_transport_template {
|
||||
};
|
||||
|
||||
#define transport_class_to_shost(tc) \
|
||||
dev_to_shost((tc)->dev)
|
||||
dev_to_shost((tc)->parent)
|
||||
|
||||
|
||||
/* Private area maintenance. The driver requested allocations come
|
||||
|
||||
@@ -163,8 +163,8 @@ enum fc_tgtid_binding_type {
|
||||
|
||||
|
||||
/* Macro for use in defining Virtual Port attributes */
|
||||
#define FC_VPORT_ATTR(_name,_mode,_show,_store) \
|
||||
struct class_device_attribute class_device_attr_vport_##_name = \
|
||||
#define FC_VPORT_ATTR(_name,_mode,_show,_store) \
|
||||
struct device_attribute dev_attr_vport_##_name = \
|
||||
__ATTR(_name,_mode,_show,_store)
|
||||
|
||||
|
||||
@@ -234,8 +234,8 @@ struct fc_vport {
|
||||
|
||||
#define dev_to_vport(d) \
|
||||
container_of(d, struct fc_vport, dev)
|
||||
#define transport_class_to_vport(classdev) \
|
||||
dev_to_vport(classdev->dev)
|
||||
#define transport_class_to_vport(dev) \
|
||||
dev_to_vport(dev->parent)
|
||||
#define vport_to_shost(v) \
|
||||
(v->shost)
|
||||
#define vport_to_shost_channel(v) \
|
||||
@@ -271,7 +271,7 @@ struct fc_rport_identifiers {
|
||||
|
||||
/* Macro for use in defining Remote Port attributes */
|
||||
#define FC_RPORT_ATTR(_name,_mode,_show,_store) \
|
||||
struct class_device_attribute class_device_attr_rport_##_name = \
|
||||
struct device_attribute dev_attr_rport_##_name = \
|
||||
__ATTR(_name,_mode,_show,_store)
|
||||
|
||||
|
||||
@@ -341,8 +341,8 @@ struct fc_rport { /* aka fc_starget_attrs */
|
||||
|
||||
#define dev_to_rport(d) \
|
||||
container_of(d, struct fc_rport, dev)
|
||||
#define transport_class_to_rport(classdev) \
|
||||
dev_to_rport(classdev->dev)
|
||||
#define transport_class_to_rport(dev) \
|
||||
dev_to_rport(dev->parent)
|
||||
#define rport_to_shost(r) \
|
||||
dev_to_shost(r->dev.parent)
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ struct sas_phy {
|
||||
|
||||
#define dev_to_phy(d) \
|
||||
container_of((d), struct sas_phy, dev)
|
||||
#define transport_class_to_phy(cdev) \
|
||||
dev_to_phy((cdev)->dev)
|
||||
#define transport_class_to_phy(dev) \
|
||||
dev_to_phy((dev)->parent)
|
||||
#define phy_to_shost(phy) \
|
||||
dev_to_shost((phy)->dev.parent)
|
||||
|
||||
@@ -96,8 +96,8 @@ struct sas_rphy {
|
||||
|
||||
#define dev_to_rphy(d) \
|
||||
container_of((d), struct sas_rphy, dev)
|
||||
#define transport_class_to_rphy(cdev) \
|
||||
dev_to_rphy((cdev)->dev)
|
||||
#define transport_class_to_rphy(dev) \
|
||||
dev_to_rphy((dev)->parent)
|
||||
#define rphy_to_shost(rphy) \
|
||||
dev_to_shost((rphy)->dev.parent)
|
||||
#define target_to_rphy(targ) \
|
||||
@@ -152,8 +152,8 @@ struct sas_port {
|
||||
|
||||
#define dev_to_sas_port(d) \
|
||||
container_of((d), struct sas_port, dev)
|
||||
#define transport_class_to_sas_port(cdev) \
|
||||
dev_to_sas_port((cdev)->dev)
|
||||
#define transport_class_to_sas_port(dev) \
|
||||
dev_to_sas_port((dev)->parent)
|
||||
|
||||
struct sas_phy_linkrates {
|
||||
enum sas_linkrate maximum_linkrate;
|
||||
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
struct scsi_disk {
|
||||
struct scsi_driver *driver; /* always &sd_template */
|
||||
struct scsi_device *device;
|
||||
struct class_device cdev;
|
||||
struct device dev;
|
||||
struct gendisk *disk;
|
||||
unsigned int openers; /* protected by BKL for now, yuck */
|
||||
sector_t capacity; /* size in 512-byte sectors */
|
||||
@@ -46,7 +46,7 @@ struct scsi_disk {
|
||||
unsigned RCD : 1; /* state of disk RCD bit, unused */
|
||||
unsigned DPOFUA : 1; /* state of disk DPOFUA bit */
|
||||
};
|
||||
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,cdev)
|
||||
#define to_scsi_disk(obj) container_of(obj,struct scsi_disk,dev)
|
||||
|
||||
#define sd_printk(prefix, sdsk, fmt, a...) \
|
||||
(sdsk)->disk ? \
|
||||
|
||||
Reference in New Issue
Block a user