mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
qlcnic: Use kobj_to_dev() instead
Use kobj_to_dev() instead of container_of() Signed-off-by: Wang Qing <wangqing@vivo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a386bc5b21
commit
0acb47a3a0
1 changed files with 17 additions and 17 deletions
|
@ -269,7 +269,7 @@ static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj,
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t offset, size_t size)
|
loff_t offset, size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ static ssize_t qlcnic_sysfs_write_crb(struct file *filp, struct kobject *kobj,
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t offset, size_t size)
|
loff_t offset, size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj,
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t offset, size_t size)
|
loff_t offset, size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
u64 data;
|
u64 data;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -337,7 +337,7 @@ static ssize_t qlcnic_sysfs_write_mem(struct file *filp, struct kobject *kobj,
|
||||||
struct bin_attribute *attr, char *buf,
|
struct bin_attribute *attr, char *buf,
|
||||||
loff_t offset, size_t size)
|
loff_t offset, size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
u64 data;
|
u64 data;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -402,7 +402,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_pm_func_cfg *pm_cfg;
|
struct qlcnic_pm_func_cfg *pm_cfg;
|
||||||
u32 id, action, pci_func;
|
u32 id, action, pci_func;
|
||||||
|
@ -452,7 +452,7 @@ static ssize_t qlcnic_sysfs_read_pm_config(struct file *filp,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_pm_func_cfg *pm_cfg;
|
struct qlcnic_pm_func_cfg *pm_cfg;
|
||||||
u8 pci_func;
|
u8 pci_func;
|
||||||
|
@ -545,7 +545,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_esw_func_cfg *esw_cfg;
|
struct qlcnic_esw_func_cfg *esw_cfg;
|
||||||
struct qlcnic_npar_info *npar;
|
struct qlcnic_npar_info *npar;
|
||||||
|
@ -629,7 +629,7 @@ static ssize_t qlcnic_sysfs_read_esw_config(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_esw_func_cfg *esw_cfg;
|
struct qlcnic_esw_func_cfg *esw_cfg;
|
||||||
u8 pci_func;
|
u8 pci_func;
|
||||||
|
@ -681,7 +681,7 @@ static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_info nic_info;
|
struct qlcnic_info nic_info;
|
||||||
struct qlcnic_npar_func_cfg *np_cfg;
|
struct qlcnic_npar_func_cfg *np_cfg;
|
||||||
|
@ -728,7 +728,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_npar_func_cfg *np_cfg;
|
struct qlcnic_npar_func_cfg *np_cfg;
|
||||||
struct qlcnic_info nic_info;
|
struct qlcnic_info nic_info;
|
||||||
|
@ -775,7 +775,7 @@ static ssize_t qlcnic_sysfs_get_port_stats(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_esw_statistics port_stats;
|
struct qlcnic_esw_statistics port_stats;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -810,7 +810,7 @@ static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_esw_statistics esw_stats;
|
struct qlcnic_esw_statistics esw_stats;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -845,7 +845,7 @@ static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -875,7 +875,7 @@ static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -904,7 +904,7 @@ static ssize_t qlcnic_sysfs_read_pci_config(struct file *file,
|
||||||
char *buf, loff_t offset,
|
char *buf, loff_t offset,
|
||||||
size_t size)
|
size_t size)
|
||||||
{
|
{
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
struct qlcnic_pci_func_cfg *pci_cfg;
|
struct qlcnic_pci_func_cfg *pci_cfg;
|
||||||
struct qlcnic_pci_info *pci_info;
|
struct qlcnic_pci_info *pci_info;
|
||||||
|
@ -946,7 +946,7 @@ static ssize_t qlcnic_83xx_sysfs_flash_read_handler(struct file *filp,
|
||||||
{
|
{
|
||||||
unsigned char *p_read_buf;
|
unsigned char *p_read_buf;
|
||||||
int ret, count;
|
int ret, count;
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
|
@ -1124,7 +1124,7 @@ static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
|
||||||
int ret;
|
int ret;
|
||||||
static int flash_mode;
|
static int flash_mode;
|
||||||
unsigned long data;
|
unsigned long data;
|
||||||
struct device *dev = container_of(kobj, struct device, kobj);
|
struct device *dev = kobj_to_dev(kobj);
|
||||||
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
|
||||||
|
|
||||||
ret = kstrtoul(buf, 16, &data);
|
ret = kstrtoul(buf, 16, &data);
|
||||||
|
|
Loading…
Reference in a new issue