}
-static ssize_t bnx2i_show_mips_status(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_mips_status(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
ssize_t len;
if (!hba->regview)
return len;
}
-static ssize_t bnx2i_show_net_if_name(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_net_if_name(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
return sprintf(buf, "%s\n", hba->netdev->name);
}
-static ssize_t bnx2i_show_sq_info(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_sq_info(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
return sprintf(buf, "0x%x\n", hba->max_sqes);
}
-static ssize_t bnx2i_set_sq_info(struct class_device *cdev,
+static ssize_t bnx2i_set_sq_info(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
u32 val;
if (sscanf(buf, " 0x%x ", &val) > 0) {
return count;
}
-static ssize_t bnx2i_show_cq_info(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_cq_info(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
return sprintf(buf, "0x%x\n", hba->max_cqes);
}
-static ssize_t bnx2i_set_cq_info(struct class_device *cdev,
+static ssize_t bnx2i_set_cq_info(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
u32 val;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (sscanf(buf, " 0x%x ", &val) > 0) {
if ((val >= BNX2I_CQ_WQES_MIN) &&
return count;
}
-static ssize_t bnx2i_show_rq_info(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_rq_info(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
return sprintf(buf, "0x%x\n", hba->max_rqes);
}
-static ssize_t bnx2i_set_rq_info(struct class_device *cdev, const char *buf,
+static ssize_t bnx2i_set_rq_info(struct device *dev, struct device_attribute *attr, const char *buf,
size_t count)
{
u32 val;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (sscanf(buf, " 0x%x ", &val) > 0) {
if ((val >= BNX2I_RQ_WQES_MIN) &&
}
-static ssize_t bnx2i_show_ccell_info(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_show_ccell_info(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
return sprintf(buf, "0x%x\n", hba->num_ccell);
}
-static ssize_t bnx2i_set_ccell_info(struct class_device *cdev,
+static ssize_t bnx2i_set_ccell_info(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
u32 val;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (sscanf(buf, " 0x%x ", &val) > 0) {
if ((val >= BNX2I_CCELLS_MIN) &&
}
-static ssize_t bnx2i_read_pci_trigger_reg(struct class_device *cdev,
+static ssize_t bnx2i_read_pci_trigger_reg(struct device *dev, struct device_attribute *attr,
char *buf)
{
u32 reg_val;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (!hba->regview)
return 0;
}
-static ssize_t bnx2i_get_iscsi_cntx_dump(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_get_iscsi_cntx_dump(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
unsigned int *ptr = (unsigned int *) hba->ctx_addr;
unsigned int *dst_ptr = (unsigned int *) buf;
int unit_sz = sizeof(unsigned int);
return SYSFS_BUF_SIZE;
}
-static ssize_t bnx2i_select_iscsi_cntx_dump(struct class_device *cdev,
+static ssize_t bnx2i_select_iscsi_cntx_dump(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
u32 iscsi_cid;
int ret = 0;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (sscanf(buf, " 0x%x ", &iscsi_cid) > 0) {
ret = bnx2i_select_ctx_dump_cid(hba, iscsi_cid);
return ret;
}
-static ssize_t bnx2i_get_active_iscsi_cid_list(struct class_device *cdev,
+static ssize_t bnx2i_get_active_iscsi_cid_list(struct device *dev, struct device_attribute *attr,
char *buf)
{
u32 active_iscsi_cid[32];
char *cur_ptr = buf;
int i;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
u32 num_ccell = hba->ctx_ccell_tasks & 0xFFFF;
u32 num_tasks_per_conn = hba->ctx_ccell_tasks >> 16;
}
-static ssize_t bnx2i_set_iscsi_cid_err_poll_mode(struct class_device *cdev,
+static ssize_t bnx2i_set_iscsi_cid_err_poll_mode(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
u32 poll_mode;
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
if (sscanf(buf, "0x%x", &poll_mode) > 0) {
if (poll_mode)
}
-static ssize_t bnx2i_get_qp_shmem_dump(struct class_device *cdev, char *buf)
+static ssize_t bnx2i_get_qp_shmem_dump(struct device *dev, struct device_attribute *attr, char *buf)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
int resi_len = hba->sq_cq_size -
(hba->sq_cq_rdp - hba->sq_cq_dump);
return 0;
}
-static ssize_t bnx2i_setup_qp_shmem_dump(struct class_device *cdev,
+static ssize_t bnx2i_setup_qp_shmem_dump(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct bnx2i_hba *hba =
- container_of(cdev, struct bnx2i_hba, class_dev);
+ container_of(dev, struct bnx2i_hba, class_dev);
u32 iscsi_cid;
char queue[32];
ssize_t ret = count;
}
-static ssize_t bnx2i_read_tcp_portd_options(struct class_device *cdev,
+static ssize_t bnx2i_read_tcp_portd_options(struct device *dev, struct device_attribute *attr,
char *buf)
{
extern struct tcp_port_mngt bnx2i_tcp_port_tbl;
return sprintf(buf, "0x%x\n", bnx2i_tcp_port_tbl.num_required);
}
-static ssize_t bnx2i_write_tcp_portd_results(struct class_device *cdev,
+static ssize_t bnx2i_write_tcp_portd_results(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
extern struct tcp_port_mngt bnx2i_tcp_port_tbl;
return count;
}
+#define CLASS_DEVICE_ATTR(a,b,c,d) DEVICE_ATTR(a,b,c,d)
static CLASS_DEVICE_ATTR (mips_info, S_IRUGO,
bnx2i_show_mips_status, NULL);
bnx2i_read_tcp_portd_options,
bnx2i_write_tcp_portd_results);
-
-static struct class_device_attribute *bnx2i_class_attributes[] = {
- &class_device_attr_mips_info,
- &class_device_attr_net_if_name,
- &class_device_attr_sq_size,
- &class_device_attr_cq_size,
- &class_device_attr_rq_size,
- &class_device_attr_num_ccell,
- &class_device_attr_pci_trigger,
- &class_device_attr_ctx_dump,
- &class_device_attr_cid_list,
- &class_device_attr_qp_shmem_dump,
+//static struct class_device_attribute *bnx2i_class_attributes[] = {
+static struct device_attribute *bnx2i_class_attributes[] = {
+ &/*class_device*/dev_attr_mips_info,
+ &/*class_device*/dev_attr_net_if_name,
+ &/*class_device*/dev_attr_sq_size,
+ &/*class_device*/dev_attr_cq_size,
+ &/*class_device*/dev_attr_rq_size,
+ &/*class_device*/dev_attr_num_ccell,
+ &/*class_device*/dev_attr_pci_trigger,
+ &/*class_device*/dev_attr_ctx_dump,
+ &/*class_device*/dev_attr_cid_list,
+ &/*class_device*/dev_attr_qp_shmem_dump,
};
-static struct class_device_attribute *tcp_port_class_attributes[] = {
- &class_device_attr_port_bind
+//static struct class_device_attribute *tcp_port_class_attributes[] = {
+static struct device_attribute *tcp_port_class_attributes[] = {
+ &/*class_device*/dev_attr_port_bind
};
-static void bnx2i_sysfs_release(struct class_device *class_dev)
+static void bnx2i_sysfs_release(struct device *class_dev)
{
}
-struct class_device port_class_dev;
+struct device port_class_dev;
static struct class bnx2i_class = {
.name = "bnx2i",
- .release = bnx2i_sysfs_release,
+ .dev_release = bnx2i_sysfs_release,
};
-static int bnx2i_register_port_class_dev(struct class_device *class_dev)
+static int bnx2i_register_port_class_dev(struct device *class_dev)
{
char dev_name[BUS_ID_SIZE];
int ret;
int i;
class_dev->class = &bnx2i_class;
- class_dev->class_data = class_dev;
+ //class_dev->class_data = class_dev;
+ //class_set_devdata(class_dev, class_dev);
+ dev_set_drvdata(class_dev, class_dev);
snprintf(dev_name, BUS_ID_SIZE, "%s", "tcp_portd");
- strlcpy(class_dev->class_id, dev_name, BUS_ID_SIZE);
+ strlcpy(class_dev->bus_id, dev_name, BUS_ID_SIZE);
- ret = class_device_register(class_dev);
+ ret = device_register(class_dev);
if (ret)
goto err;
for (i = 0; i < ARRAY_SIZE(tcp_port_class_attributes); ++i) {
- ret = class_device_create_file(class_dev,
+ ret = device_create_file(class_dev,
tcp_port_class_attributes[i]);
if (ret)
goto err_unregister;
return 0;
err_unregister:
- class_device_unregister(class_dev);
+ device_unregister(class_dev);
err:
return ret;
}
int bnx2i_register_sysfs(struct bnx2i_hba *hba)
{
- struct class_device *class_dev = &hba->class_dev;
+ struct device *class_dev = &hba->class_dev;
char dev_name[BUS_ID_SIZE];
struct ethtool_drvinfo drv_info;
u32 bus_no;
&extra, &bus_no, &dev_no, &func_no);
}
class_dev->class = &bnx2i_class;
- class_dev->class_data = hba;
+ //class_dev->class_data = hba;
+ //class_set_devdata(class_dev, hba);
+ dev_set_drvdata(class_dev, hba);
snprintf(dev_name, BUS_ID_SIZE, "%.2x:%.2x.%.1x",
bus_no, dev_no, func_no);
- strlcpy(class_dev->class_id, dev_name, BUS_ID_SIZE);
+ strlcpy(class_dev->bus_id, dev_name, BUS_ID_SIZE);
- ret = class_device_register(class_dev);
+ ret = device_register(class_dev);
if (ret)
goto err;
for (i = 0; i < ARRAY_SIZE(bnx2i_class_attributes); ++i) {
- ret = class_device_create_file(class_dev,
+ ret = device_create_file(class_dev,
bnx2i_class_attributes[i]);
if (ret)
goto err_unregister;
return 0;
err_unregister:
- class_device_unregister(class_dev);
+ device_unregister(class_dev);
err:
return ret;
}
void bnx2i_unregister_sysfs(struct bnx2i_hba *hba)
{
- class_device_unregister(&hba->class_dev);
+ device_unregister(&hba->class_dev);
}
int bnx2i_sysfs_setup(void)
void bnx2i_sysfs_cleanup(void)
{
- class_device_unregister(&port_class_dev);
+ device_unregister(&port_class_dev);
class_unregister(&bnx2i_class);
}