[Open-FCoE] [PATCH] [FCoE] Remove using struct class_device and usestruct device

Dev, Vasu vasu.dev at intel.com
Tue May 6 17:51:21 UTC 2008



>-----Original Message-----
>From: devel-bounces at open-fcoe.org [mailto:devel-bounces at open-fcoe.org]
On
>Behalf Of Yi Zou
>-static struct fcs_state *fcs_class_device_state(struct class_device
*cdev)
>+static struct fcs_state *fcs_device_state(struct device *cdev)
> {
>-	struct openfc_softc *openfcp = cdev->class_data;
>+	struct openfc_softc *openfcp = cdev->driver_data;
>
> 	return openfcp->fcs_state;
> }
>

May be  cdev should be now only dev as this is no longer of type struct
class_device, this change would be similar to change of cdev->class_data
to cdev->driver_data at all places in this patch. So just a minor
feedback to change cdev to dev at all places in this patch but leaving
it as is also fine with me.

>-static struct fc_virt_fab *fcs_class_device_vf(struct class_device
*cdev)
>+static struct fc_virt_fab *fcs_device_vf(struct device *cdev)
> {
>-	return fcs_class_device_state(cdev)->fs_vf;
>+	return fcs_device_state(cdev)->fs_vf;
> }
>
>-static struct fc_exch_mgr *fcs_class_device_exch_mgr(struct
class_device
>*cdev)
>+static struct fc_exch_mgr *fcs_device_exch_mgr(struct device *cdev)
> {
>-	return fcs_class_device_vf(cdev)->vf_exch_mgr;
>+	return fcs_device_vf(cdev)->vf_exch_mgr;
> }
>
>-static struct fc_local_port *fcs_class_device_local_port(struct
class_device
>+static struct fc_local_port *fcs_device_local_port(struct device
> 							 *cdev)
> {
>-	return
list_first_entry(&fcs_class_device_vf(cdev)->vf_local_ports,
>struct fc_local_port, fl_list);
>+	return list_first_entry(&fcs_device_vf(cdev)->vf_local_ports,
struct
>fc_local_port, fl_list);
> }
>
> #if 0				/* XXX not used just now */
>-static ssize_t fcs_exch_show_int(struct class_device *cdev, char *buf,
>+static ssize_t fcs_exch_show_int(struct device *cdev, char *buf,
> 				 u_int offset)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
> 	u_int *ip;
>
> 	ip = (u_int *) ((char *)mp + offset);
>@@ -87,10 +87,10 @@ static ssize_t fcs_exch_show_int(struct
class_device *cdev,
>char *buf,
> }
> #endif /* XXX */
>
>-static ssize_t fcs_exch_show_atomic(struct class_device *cdev, char
*buf,
>+static ssize_t fcs_exch_show_atomic(struct device *cdev, char *buf,
> 				    u_int offset)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
> 	atomic_t *ap;
>
> 	ap = (atomic_t *) ((char *)mp + offset);
>@@ -101,48 +101,47 @@ static ssize_t fcs_exch_show_atomic(struct
class_device
>*cdev, char *buf,
>  * Macro to declare routines showing statistics.
>  */
> #define FCS_EM_ATTR_STAT(_name) \
>-static ssize_t fcs_exch_show_##_name(struct class_device *cdev, char
*buf) \
>+static ssize_t fcs_exch_show_##_name(struct device *cdev,\
>+				     struct device_attribute *attr, char
*buf) \
> { \
> 	return fcs_exch_show_atomic(cdev, buf, \
> 			offsetof(struct fc_exch_mgr,
em_stats.ems_##_name)); \
> } \
>-static CLASS_DEVICE_ATTR(_name, S_IRUGO, fcs_exch_show_##_name, NULL);
>-
>-#define FCS_EM_ATTR_INT(_name) \
>-static ssize_t fcs_exch_show_##_name(struct class_device *cdev, char
*buf) \
>-{ \
>-	return fcs_exch_show_int(cdev, buf, \
>-			offsetof(struct fc_exch_mgr, em_##_name)); \
>-} \
>-static CLASS_DEVICE_ATTR(_name, S_IRUGO, fcs_exch_show_##_name, NULL);
>+static DEVICE_ATTR(_name, S_IRUGO, fcs_exch_show_##_name, NULL);
>
> FCS_EM_ATTR_STAT(error_no_free_exch)
>-    FCS_EM_ATTR_STAT(error_xid_not_found)
>-    FCS_EM_ATTR_STAT(error_xid_busy)
>-    FCS_EM_ATTR_STAT(error_seq_not_found)
>-    FCS_EM_ATTR_STAT(error_non_bls_resp)
>-
>-static ssize_t fcs_exch_show_xid_min(struct class_device *cdev, char
*buf)
>+FCS_EM_ATTR_STAT(error_xid_not_found)
>+FCS_EM_ATTR_STAT(error_xid_busy)
>+FCS_EM_ATTR_STAT(error_seq_not_found)
>+FCS_EM_ATTR_STAT(error_non_bls_resp)
>+
>+static ssize_t fcs_exch_show_xid_min(struct device *cdev,
>+				     struct device_attribute *attr,
>+				     char *buf)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "0x%x\n", mp->em_min_xid);
> }
>
>-static CLASS_DEVICE_ATTR(xid_min, S_IRUGO, fcs_exch_show_xid_min,
NULL);
>+static DEVICE_ATTR(xid_min, S_IRUGO, fcs_exch_show_xid_min, NULL);
>
>-static ssize_t fcs_exch_show_xid_max(struct class_device *cdev, char
*buf)
>+static ssize_t fcs_exch_show_xid_max(struct device *cdev,
>+				     struct device_attribute *attr,
>+				     char *buf)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "0x%x\n", mp->em_max_xid);
> }
>
>-static CLASS_DEVICE_ATTR(xid_max, S_IRUGO, fcs_exch_show_xid_max,
NULL);
>+static DEVICE_ATTR(xid_max, S_IRUGO, fcs_exch_show_xid_max, NULL);
>
>-static ssize_t fcs_exch_show_xid_inuse(struct class_device *cdev, char
*buf)
>+static ssize_t fcs_exch_show_xid_inuse(struct device *cdev,
>+				       struct device_attribute *attr,
>+				       char *buf)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
> 	struct fc_exch_pool *pp;
> 	u_int count = 0;
> 	unsigned int pool_count;
>@@ -153,11 +152,13 @@ static ssize_t fcs_exch_show_xid_inuse(struct
>class_device *cdev, char *buf)
> 	return snprintf(buf, PAGE_SIZE, "%u\n", count);
> }
>
>-static CLASS_DEVICE_ATTR(xid_inuse, S_IRUGO, fcs_exch_show_xid_inuse,
NULL);
>+static DEVICE_ATTR(xid_inuse, S_IRUGO, fcs_exch_show_xid_inuse, NULL);
>
>-static ssize_t fcs_exch_show_xid_total(struct class_device *cdev, char
*buf)
>+static ssize_t fcs_exch_show_xid_total(struct device *cdev,
>+				       struct device_attribute *attr,
>+				       char *buf)
> {
>-	struct fc_exch_mgr *mp = fcs_class_device_exch_mgr(cdev);
>+	struct fc_exch_mgr *mp = fcs_device_exch_mgr(cdev);
> 	struct fc_exch_pool *pp;
> 	u_int count = 0;
> 	unsigned int pool_count;
>@@ -168,18 +169,18 @@ static ssize_t fcs_exch_show_xid_total(struct
>class_device *cdev, char *buf)
> 	return snprintf(buf, PAGE_SIZE, "%u\n", count);
> }
>
>-static CLASS_DEVICE_ATTR(xid_total, S_IRUGO, fcs_exch_show_xid_total,
NULL);
>-
>-static struct class_device_attribute *fcs_exch_attrs[] = {
>-	&class_device_attr_error_no_free_exch,
>-	&class_device_attr_error_xid_not_found,
>-	&class_device_attr_error_xid_busy,
>-	&class_device_attr_error_seq_not_found,
>-	&class_device_attr_error_non_bls_resp,
>-	&class_device_attr_xid_min,
>-	&class_device_attr_xid_max,
>-	&class_device_attr_xid_inuse,
>-	&class_device_attr_xid_total,
>+static DEVICE_ATTR(xid_total, S_IRUGO, fcs_exch_show_xid_total, NULL);
>+
>+static struct device_attribute *fcs_exch_attrs[] = {
>+	&dev_attr_error_no_free_exch,
>+	&dev_attr_error_xid_not_found,
>+	&dev_attr_error_xid_busy,
>+	&dev_attr_error_seq_not_found,
>+	&dev_attr_error_non_bls_resp,
>+	&dev_attr_xid_min,
>+	&dev_attr_xid_max,
>+	&dev_attr_xid_inuse,
>+	&dev_attr_xid_total,
> 	NULL,
> };
>
>@@ -195,98 +196,110 @@ struct attribute_group fcs_exch_attr_group = {
> /*
>  * Including WWNs here for now.  Also provided under
/sys/class/fc_hosts.
>  */
>-static ssize_t fcs_local_port_show_port_wwn(struct class_device *cdev,
>+static ssize_t fcs_local_port_show_port_wwn(struct device *cdev,
>+					    struct device_attribute
*attr,
> 					    char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "0x%8.8llx\n", lp->fl_port_wwn);
> }
>
>-static ssize_t fcs_local_port_show_node_wwn(struct class_device *cdev,
>+static ssize_t fcs_local_port_show_node_wwn(struct device *cdev,
>+					    struct device_attribute
*attr,
> 					    char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "0x%8.8llx\n", lp->fl_node_wwn);
> }
>
>-static ssize_t fcs_local_port_show_e_d_tov(struct class_device *cdev,
char
>*buf)
>+static ssize_t fcs_local_port_show_e_d_tov(struct device *cdev,
>+					   struct device_attribute
*attr,
>+					   char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_e_d_tov);
> }
>
>-static ssize_t fcs_local_port_show_r_a_tov(struct class_device *cdev,
char
>*buf)
>+static ssize_t fcs_local_port_show_r_a_tov(struct device *cdev,
>+					   struct device_attribute
*attr,
>+					   char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_r_a_tov);
> }
>
>-static ssize_t fcs_local_port_show_max_payload(struct class_device
*cdev,
>+static ssize_t fcs_local_port_show_max_payload(struct device *cdev,
>+					       struct device_attribute
*attr,
> 					       char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_max_payload);
> }
>
>-static ssize_t fcs_local_port_show_retry_limit(struct class_device
*cdev,
>+static ssize_t fcs_local_port_show_retry_limit(struct device *cdev,
>+					       struct device_attribute
*attr,
> 					       char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_retry_limit);
> }
>
>-static ssize_t fcs_local_port_show_state(struct class_device *cdev,
char *buf)
>+static ssize_t fcs_local_port_show_state(struct device *cdev,
>+					 struct device_attribute *attr,
>+					 char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%s\n",
fc_local_port_state(lp));
> }
>
>-static ssize_t fcs_local_port_show_disc_ver(struct class_device *cdev,
>+static ssize_t fcs_local_port_show_disc_ver(struct device *cdev,
>+					    struct device_attribute
*attr,
>
> 					    char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_disc_ver);
> }
>
>-static ssize_t fcs_local_port_show_disc_in_prog(struct class_device
*cdev,
>+static ssize_t fcs_local_port_show_disc_in_prog(struct device *cdev,
>+					        struct device_attribute
*attr,
> 						char *buf)
> {
>-	struct fc_local_port *lp = fcs_class_device_local_port(cdev);
>+	struct fc_local_port *lp = fcs_device_local_port(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "%u\n", lp->fl_disc_in_prog);
> }
>
>-static CLASS_DEVICE_ATTR(port_wwn, S_IRUGO,
fcs_local_port_show_port_wwn,
>NULL);
>-static CLASS_DEVICE_ATTR(node_wwn, S_IRUGO,
fcs_local_port_show_node_wwn,
>NULL);
>-static CLASS_DEVICE_ATTR(e_d_tov, S_IRUGO,
fcs_local_port_show_e_d_tov, NULL);
>-static CLASS_DEVICE_ATTR(r_a_tov, S_IRUGO,
fcs_local_port_show_r_a_tov, NULL);
>-static CLASS_DEVICE_ATTR(max_payload, S_IRUGO,
>+static DEVICE_ATTR(port_wwn, S_IRUGO, fcs_local_port_show_port_wwn,
NULL);
>+static DEVICE_ATTR(node_wwn, S_IRUGO, fcs_local_port_show_node_wwn,
NULL);
>+static DEVICE_ATTR(e_d_tov, S_IRUGO, fcs_local_port_show_e_d_tov,
NULL);
>+static DEVICE_ATTR(r_a_tov, S_IRUGO, fcs_local_port_show_r_a_tov,
NULL);
>+static DEVICE_ATTR(max_payload, S_IRUGO,
> 			 fcs_local_port_show_max_payload, NULL);
>-static CLASS_DEVICE_ATTR(retry_limit, S_IRUGO,
>+static DEVICE_ATTR(retry_limit, S_IRUGO,
> 			 fcs_local_port_show_retry_limit, NULL);
>-static CLASS_DEVICE_ATTR(state, S_IRUGO, fcs_local_port_show_state,
NULL);
>-static CLASS_DEVICE_ATTR(disc_ver, S_IRUGO,
fcs_local_port_show_disc_ver,
>NULL);
>-static CLASS_DEVICE_ATTR(disc_in_prog, S_IRUGO,
>+static DEVICE_ATTR(state, S_IRUGO, fcs_local_port_show_state, NULL);
>+static DEVICE_ATTR(disc_ver, S_IRUGO, fcs_local_port_show_disc_ver,
NULL);
>+static DEVICE_ATTR(disc_in_prog, S_IRUGO,
> 			 fcs_local_port_show_disc_in_prog, NULL);
>
>-static struct class_device_attribute *fcs_local_port_attrs[] = {
>-	&class_device_attr_port_wwn,
>-	&class_device_attr_node_wwn,
>-	&class_device_attr_e_d_tov,
>-	&class_device_attr_r_a_tov,
>-	&class_device_attr_max_payload,
>-	&class_device_attr_retry_limit,
>-	&class_device_attr_state,
>-	&class_device_attr_disc_ver,
>-	&class_device_attr_disc_in_prog,
>+static struct device_attribute *fcs_local_port_attrs[] = {
>+	&dev_attr_port_wwn,
>+	&dev_attr_node_wwn,
>+	&dev_attr_e_d_tov,
>+	&dev_attr_r_a_tov,
>+	&dev_attr_max_payload,
>+	&dev_attr_retry_limit,
>+	&dev_attr_state,
>+	&dev_attr_disc_ver,
>+	&dev_attr_disc_in_prog,
> 	NULL,
> };
>
>diff --git a/drivers/scsi/ofc/openfc/openfc_attr.c
>b/drivers/scsi/ofc/openfc/openfc_attr.c
>index 6001c7d..0b04563 100644
>--- a/drivers/scsi/ofc/openfc/openfc_attr.c
>+++ b/drivers/scsi/ofc/openfc/openfc_attr.c
>@@ -49,23 +49,31 @@ extern int opnefc_reset_if(struct openfc_softc *);
> /*
>  * Scsi_Host class Attributes
>  */
>-static ssize_t openfc_drv_version_show(struct class_device *cdev, char
*buf)
>+static ssize_t openfc_drv_version_show(struct device *cdev,
>+				       struct device_attribute *attr,
>+				       char *buf)
> {
> 	return snprintf(buf, PAGE_SIZE, "%s\n", openfc_version_str);
> }
>
>-static ssize_t openfc_name_show(struct class_device *cdev, char *buf)
>+static ssize_t openfc_name_show(struct device *cdev,
>+				struct device_attribute *attr,
>+				char *buf)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
>
> 	return snprintf(buf, PAGE_SIZE, "FCOEHBA%d\n", host->host_no);
> }
>-static ssize_t openfc_info_show(struct class_device *cdev, char *buf)
>+static ssize_t openfc_info_show(struct device *cdev,
>+				struct device_attribute *attr,
>+				char *buf)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
> 	return snprintf(buf, PAGE_SIZE, "%s", openfc_info(host));
> }
>-static ssize_t openfc_state_show(struct class_device *cdev, char *buf)
>+static ssize_t openfc_state_show(struct device *cdev,
>+				 struct device_attribute *attr,
>+				 char *buf)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
> 	struct openfc_softc *openfcp = (struct openfc_softc
*)host->hostdata;
>@@ -99,7 +107,8 @@ static ssize_t openfc_state_show(struct class_device
*cdev,
>char *buf)
> 	return len;
> }
>
>-static ssize_t openfc_stop(struct class_device *cdev,
>+static ssize_t openfc_stop(struct device *cdev,
>+			   struct device_attribute *attr,
> 			   const char *buffer, size_t size)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
>@@ -123,7 +132,8 @@ static ssize_t openfc_stop(struct class_device
*cdev,
> 	return size;
> }
>
>-static ssize_t openfc_start(struct class_device *cdev,
>+static ssize_t openfc_start(struct device *cdev,
>+			    struct device_attribute *attr,
> 			    const char *buffer, size_t size)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
>@@ -146,7 +156,8 @@ static ssize_t openfc_start(struct class_device
*cdev,
>
> 	return size;
> }
>-static ssize_t openfc_reset(struct class_device *cdev,
>+static ssize_t openfc_reset(struct device *cdev,
>+			    struct device_attribute *attr,
> 			    const char *buffer, size_t size)
> {
> 	struct Scsi_Host *host = class_to_shost(cdev);
>@@ -187,23 +198,23 @@ char *openfc_info(struct Scsi_Host *host)
> 	return NULL;
> }
>
>-static CLASS_DEVICE_ATTR(driver_version, S_IRUGO,
>+static DEVICE_ATTR(driver_version, S_IRUGO,
> 			 openfc_drv_version_show, NULL);
>-static CLASS_DEVICE_ATTR(info, S_IRUGO, openfc_info_show, NULL);
>-static CLASS_DEVICE_ATTR(fcoe_name, S_IRUGO, openfc_name_show, NULL);
>-static CLASS_DEVICE_ATTR(state, S_IRUGO, openfc_state_show, NULL);
>-static CLASS_DEVICE_ATTR(stop, S_IWUSR, NULL, openfc_stop);
>-static CLASS_DEVICE_ATTR(start, S_IWUSR, NULL, openfc_start);
>-static CLASS_DEVICE_ATTR(reset, S_IWUSR, NULL, openfc_reset);
>-
>-struct class_device_attribute *openfc_host_attrs[] = {
>-	&class_device_attr_driver_version,
>-	&class_device_attr_info,
>-	&class_device_attr_fcoe_name,
>-	&class_device_attr_state,
>-	&class_device_attr_stop,
>-	&class_device_attr_start,
>-	&class_device_attr_reset,
>+static DEVICE_ATTR(info, S_IRUGO, openfc_info_show, NULL);
>+static DEVICE_ATTR(fcoe_name, S_IRUGO, openfc_name_show, NULL);
>+static DEVICE_ATTR(state, S_IRUGO, openfc_state_show, NULL);
>+static DEVICE_ATTR(stop, S_IWUSR, NULL, openfc_stop);
>+static DEVICE_ATTR(start, S_IWUSR, NULL, openfc_start);
>+static DEVICE_ATTR(reset, S_IWUSR, NULL, openfc_reset);
>+
>+struct device_attribute *openfc_host_attrs[] = {
>+	&dev_attr_driver_version,
>+	&dev_attr_info,
>+	&dev_attr_fcoe_name,
>+	&dev_attr_state,
>+	&dev_attr_stop,
>+	&dev_attr_start,
>+	&dev_attr_reset,
> 	NULL,
> };
>
>diff --git a/drivers/scsi/ofc/openfc/openfc_if.c
>b/drivers/scsi/ofc/openfc/openfc_if.c
>index c594ccb..05406f1 100644
>--- a/drivers/scsi/ofc/openfc/openfc_if.c
>+++ b/drivers/scsi/ofc/openfc/openfc_if.c
>@@ -82,7 +82,7 @@ static int openfc_change_queue_depth(struct
scsi_device *,
>int);
> static int openfc_change_queue_type(struct scsi_device *, int);
> extern void openfc_fc_attr_init(struct openfc_softc *);
> extern struct fc_function_template openfc_transport_function;
>-extern struct class_device_attribute *openfc_host_attrs[];
>+extern struct device_attribute *openfc_host_attrs[];
> extern int openfc_scsi_send(struct fcdev *, struct fc_scsi_pkt *);
> extern int openfc_abort_cmd(struct fcdev *, struct fc_scsi_pkt *);
> extern int openfc_target_reset(struct fcdev *, struct fc_scsi_pkt *);
>@@ -921,7 +921,7 @@ int openfc_register(struct fcdev *dev)
> {
> 	struct openfc_softc *openfcp;
> 	struct Scsi_Host *host;
>-	struct class_device *cp;
>+	struct device *cp;
> 	int i;
> 	int rc;
> 	struct fcs_create_args ofc_fcs_args = openfc_fcs_args;
>@@ -1003,17 +1003,17 @@ int openfc_register(struct fcdev *dev)
> 	 * Initialize sysfs device for the instance.
> 	 * Create /sys/class/openfc/host<n> groups and attributes.
> 	 */
>-	cp = &openfcp->openfc_class_device;
>-	class_device_initialize(cp);
>+	cp = &openfcp->openfc_device;
>+	device_initialize(cp);
> 	cp->class = openfc_class;
>-	cp->class_data = openfcp;
>+	cp->driver_data = openfcp;
> #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16)
> 	cp->groups = openfc_groups;
> #endif
>-	snprintf(cp->class_id, sizeof(cp->class_id), "host%d",
host->host_no);
>-	rc = class_device_add(cp);
>+	snprintf(cp->bus_id, sizeof(cp->bus_id), "host%d",
host->host_no);
>+	rc = device_add(cp);
> 	if (rc) {
>-		OFC_DBG("class_device_add failed rc %d", rc);
>+		OFC_DBG("device_add failed rc %d", rc);
> 		goto out_fcs;
> 	}
> 	if (dev->fd_link_status == TRANS_LINK_DOWN) {
>@@ -1062,8 +1062,8 @@ void openfc_unregister(struct fcdev *dev)
> 	ulong flags;
> 	struct fc_scsi_pkt *fsp;
>
>-	if (!list_empty(&openfcp->openfc_class_device.node))
>-		class_device_del(&openfcp->openfc_class_device);
>+	if (!list_empty(&openfcp->openfc_device.node))
>+		device_del(&openfcp->openfc_device);
>
> 	spin_lock_irqsave(openfcp->host->host_lock, flags);
>
>diff --git a/drivers/scsi/ofc/openfc/openfc_ioctl.c
>b/drivers/scsi/ofc/openfc/openfc_ioctl.c
>index e99de75..ea37aff 100644
>--- a/drivers/scsi/ofc/openfc/openfc_ioctl.c
>+++ b/drivers/scsi/ofc/openfc/openfc_ioctl.c
>@@ -533,8 +533,8 @@ int openfc_ioctl_init(void)
> 		rc = -ENODEV;
> 		goto out_chrdev;
> 	}
>-	class_device_create(openfc_class, NULL,
>-			    MKDEV(openfc_major, 0), NULL,
OPENFC_DEV_NAME);
>+	device_create(openfc_class, NULL,
>+		      MKDEV(openfc_major, 0), OPENFC_DEV_NAME);
>
> 	return rc;
> out_chrdev:
>@@ -545,7 +545,7 @@ out:
>
> int openfc_ioctl_exit(void)
> {
>-	class_device_destroy(openfc_class, MKDEV(openfc_major, 0));
>+	device_destroy(openfc_class, MKDEV(openfc_major, 0));
> 	class_destroy(openfc_class);
> 	openfc_unreg_char_dev();
> 	return 0;
>
>_______________________________________________
>devel mailing list
>devel at open-fcoe.org
>http://www.open-fcoe.org/mailman/listinfo/devel



More information about the devel mailing list