mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
driver core: class: remove struct class_interface * from callbacks
The add_dev and remove_dev callbacks in struct class_interface currently pass in a pointer back to the class_interface structure that is calling them, but none of the callback implementations actually use this pointer as it is pointless (the structure is known, the driver passed it in in the first place if it is really needed again.) So clean this up and just remove the pointer from the callbacks and fix up all callback functions. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <edumazet@google.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Kurt Schwemmer <kurt.schwemmer@microsemi.com> Cc: Jon Mason <jdmason@kudzu.us> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Allen Hubbe <allenbh@gmail.com> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Alexandre Bounine <alex.bou9@gmail.com> Cc: "James E.J. Bottomley" <jejb@linux.ibm.com> Cc: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: Doug Gilbert <dgilbert@interlog.com> Cc: John Stultz <jstultz@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Stephen Boyd <sboyd@kernel.org> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Wang Weiyang <wangweiyang2@huawei.com> Cc: Yang Yingliang <yangyingliang@huawei.com> Cc: Jakob Koschel <jakobkoschel@gmail.com> Cc: Cai Xinchen <caixinchen1@huawei.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Acked-by: Logan Gunthorpe <logang@deltatee.com> Link: https://lore.kernel.org/r/2023040250-pushover-platter-509c@gregkh Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6b0d49be81
commit
2243acd50a
|
@ -486,7 +486,7 @@ int class_interface_register(struct class_interface *class_intf)
|
||||||
if (class_intf->add_dev) {
|
if (class_intf->add_dev) {
|
||||||
class_dev_iter_init(&iter, parent, NULL, NULL);
|
class_dev_iter_init(&iter, parent, NULL, NULL);
|
||||||
while ((dev = class_dev_iter_next(&iter)))
|
while ((dev = class_dev_iter_next(&iter)))
|
||||||
class_intf->add_dev(dev, class_intf);
|
class_intf->add_dev(dev);
|
||||||
class_dev_iter_exit(&iter);
|
class_dev_iter_exit(&iter);
|
||||||
}
|
}
|
||||||
mutex_unlock(&sp->mutex);
|
mutex_unlock(&sp->mutex);
|
||||||
|
@ -514,7 +514,7 @@ void class_interface_unregister(struct class_interface *class_intf)
|
||||||
if (class_intf->remove_dev) {
|
if (class_intf->remove_dev) {
|
||||||
class_dev_iter_init(&iter, parent, NULL, NULL);
|
class_dev_iter_init(&iter, parent, NULL, NULL);
|
||||||
while ((dev = class_dev_iter_next(&iter)))
|
while ((dev = class_dev_iter_next(&iter)))
|
||||||
class_intf->remove_dev(dev, class_intf);
|
class_intf->remove_dev(dev);
|
||||||
class_dev_iter_exit(&iter);
|
class_dev_iter_exit(&iter);
|
||||||
}
|
}
|
||||||
mutex_unlock(&sp->mutex);
|
mutex_unlock(&sp->mutex);
|
||||||
|
|
|
@ -541,8 +541,7 @@ static struct class devlink_class = {
|
||||||
.dev_release = devlink_dev_release,
|
.dev_release = devlink_dev_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int devlink_add_symlinks(struct device *dev,
|
static int devlink_add_symlinks(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -591,8 +590,7 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void devlink_remove_symlinks(struct device *dev,
|
static void devlink_remove_symlinks(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct device_link *link = to_devlink(dev);
|
struct device_link *link = to_devlink(dev);
|
||||||
size_t len;
|
size_t len;
|
||||||
|
@ -3647,7 +3645,7 @@ int device_add(struct device *dev)
|
||||||
/* notify any interfaces that the device is here */
|
/* notify any interfaces that the device is here */
|
||||||
list_for_each_entry(class_intf, &sp->interfaces, node)
|
list_for_each_entry(class_intf, &sp->interfaces, node)
|
||||||
if (class_intf->add_dev)
|
if (class_intf->add_dev)
|
||||||
class_intf->add_dev(dev, class_intf);
|
class_intf->add_dev(dev);
|
||||||
mutex_unlock(&sp->mutex);
|
mutex_unlock(&sp->mutex);
|
||||||
subsys_put(sp);
|
subsys_put(sp);
|
||||||
}
|
}
|
||||||
|
@ -3805,7 +3803,7 @@ void device_del(struct device *dev)
|
||||||
/* notify any interfaces that the device is now gone */
|
/* notify any interfaces that the device is now gone */
|
||||||
list_for_each_entry(class_intf, &sp->interfaces, node)
|
list_for_each_entry(class_intf, &sp->interfaces, node)
|
||||||
if (class_intf->remove_dev)
|
if (class_intf->remove_dev)
|
||||||
class_intf->remove_dev(dev, class_intf);
|
class_intf->remove_dev(dev);
|
||||||
/* remove the device from the class list */
|
/* remove the device from the class list */
|
||||||
klist_del(&dev->p->knode_class);
|
klist_del(&dev->p->knode_class);
|
||||||
mutex_unlock(&sp->mutex);
|
mutex_unlock(&sp->mutex);
|
||||||
|
|
|
@ -550,7 +550,7 @@ static const struct hwmon_chip_info drivetemp_chip_info = {
|
||||||
* The device argument points to sdev->sdev_dev. Its parent is
|
* The device argument points to sdev->sdev_dev. Its parent is
|
||||||
* sdev->sdev_gendev, which we can use to get the scsi_device pointer.
|
* sdev->sdev_gendev, which we can use to get the scsi_device pointer.
|
||||||
*/
|
*/
|
||||||
static int drivetemp_add(struct device *dev, struct class_interface *intf)
|
static int drivetemp_add(struct device *dev)
|
||||||
{
|
{
|
||||||
struct scsi_device *sdev = to_scsi_device(dev->parent);
|
struct scsi_device *sdev = to_scsi_device(dev->parent);
|
||||||
struct drivetemp_data *st;
|
struct drivetemp_data *st;
|
||||||
|
@ -585,7 +585,7 @@ abort:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drivetemp_remove(struct device *dev, struct class_interface *intf)
|
static void drivetemp_remove(struct device *dev)
|
||||||
{
|
{
|
||||||
struct drivetemp_data *st, *tmp;
|
struct drivetemp_data *st, *tmp;
|
||||||
|
|
||||||
|
|
|
@ -662,8 +662,7 @@ static int rionet_shutdown(struct notifier_block *nb, unsigned long code,
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rionet_remove_mport(struct device *dev,
|
static void rionet_remove_mport(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct rio_mport *mport = to_rio_mport(dev);
|
struct rio_mport *mport = to_rio_mport(dev);
|
||||||
struct net_device *ndev;
|
struct net_device *ndev;
|
||||||
|
|
|
@ -1470,8 +1470,7 @@ static int switchtec_ntb_reinit_peer(struct switchtec_ntb *sndev)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int switchtec_ntb_add(struct device *dev,
|
static int switchtec_ntb_add(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct switchtec_dev *stdev = to_stdev(dev);
|
struct switchtec_dev *stdev = to_stdev(dev);
|
||||||
struct switchtec_ntb *sndev;
|
struct switchtec_ntb *sndev;
|
||||||
|
@ -1541,8 +1540,7 @@ free_and_exit:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void switchtec_ntb_remove(struct device *dev,
|
static void switchtec_ntb_remove(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct switchtec_dev *stdev = to_stdev(dev);
|
struct switchtec_dev *stdev = to_stdev(dev);
|
||||||
struct switchtec_ntb *sndev = stdev->sndev;
|
struct switchtec_ntb *sndev = stdev->sndev;
|
||||||
|
|
|
@ -1335,8 +1335,7 @@ static struct pcmcia_callback pcmcia_bus_callback = {
|
||||||
.resume = pcmcia_bus_resume,
|
.resume = pcmcia_bus_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pcmcia_bus_add_socket(struct device *dev,
|
static int pcmcia_bus_add_socket(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct pcmcia_socket *socket = dev_get_drvdata(dev);
|
struct pcmcia_socket *socket = dev_get_drvdata(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -1369,8 +1368,7 @@ static int pcmcia_bus_add_socket(struct device *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pcmcia_bus_remove_socket(struct device *dev,
|
static void pcmcia_bus_remove_socket(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct pcmcia_socket *socket = dev_get_drvdata(dev);
|
struct pcmcia_socket *socket = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
|
|
@ -1200,8 +1200,7 @@ static const struct attribute_group rsrc_attributes = {
|
||||||
.attrs = pccard_rsrc_attributes,
|
.attrs = pccard_rsrc_attributes,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int pccard_sysfs_add_rsrc(struct device *dev,
|
static int pccard_sysfs_add_rsrc(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct pcmcia_socket *s = dev_get_drvdata(dev);
|
struct pcmcia_socket *s = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
@ -1210,8 +1209,7 @@ static int pccard_sysfs_add_rsrc(struct device *dev,
|
||||||
return sysfs_create_group(&dev->kobj, &rsrc_attributes);
|
return sysfs_create_group(&dev->kobj, &rsrc_attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pccard_sysfs_remove_rsrc(struct device *dev,
|
static void pccard_sysfs_remove_rsrc(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct pcmcia_socket *s = dev_get_drvdata(dev);
|
struct pcmcia_socket *s = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
|
|
@ -2536,10 +2536,8 @@ static void mport_cdev_remove(struct mport_dev *md)
|
||||||
/*
|
/*
|
||||||
* mport_add_mport() - Add rio_mport from LDM device struct
|
* mport_add_mport() - Add rio_mport from LDM device struct
|
||||||
* @dev: Linux device model struct
|
* @dev: Linux device model struct
|
||||||
* @class_intf: Linux class_interface
|
|
||||||
*/
|
*/
|
||||||
static int mport_add_mport(struct device *dev,
|
static int mport_add_mport(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct rio_mport *mport = NULL;
|
struct rio_mport *mport = NULL;
|
||||||
struct mport_dev *chdev = NULL;
|
struct mport_dev *chdev = NULL;
|
||||||
|
@ -2559,8 +2557,7 @@ static int mport_add_mport(struct device *dev,
|
||||||
* mport_remove_mport() - Remove rio_mport from global list
|
* mport_remove_mport() - Remove rio_mport from global list
|
||||||
* TODO remove device from global mport_dev list
|
* TODO remove device from global mport_dev list
|
||||||
*/
|
*/
|
||||||
static void mport_remove_mport(struct device *dev,
|
static void mport_remove_mport(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct rio_mport *mport = NULL;
|
struct rio_mport *mport = NULL;
|
||||||
struct mport_dev *chdev;
|
struct mport_dev *chdev;
|
||||||
|
|
|
@ -2087,13 +2087,11 @@ static int riocm_cdev_add(dev_t devno)
|
||||||
/*
|
/*
|
||||||
* riocm_add_mport - add new local mport device into channel management core
|
* riocm_add_mport - add new local mport device into channel management core
|
||||||
* @dev: device object associated with mport
|
* @dev: device object associated with mport
|
||||||
* @class_intf: class interface
|
|
||||||
*
|
*
|
||||||
* When a new mport device is added, CM immediately reserves inbound and
|
* When a new mport device is added, CM immediately reserves inbound and
|
||||||
* outbound RapidIO mailboxes that will be used.
|
* outbound RapidIO mailboxes that will be used.
|
||||||
*/
|
*/
|
||||||
static int riocm_add_mport(struct device *dev,
|
static int riocm_add_mport(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
int i;
|
int i;
|
||||||
|
@ -2166,14 +2164,12 @@ static int riocm_add_mport(struct device *dev,
|
||||||
/*
|
/*
|
||||||
* riocm_remove_mport - remove local mport device from channel management core
|
* riocm_remove_mport - remove local mport device from channel management core
|
||||||
* @dev: device object associated with mport
|
* @dev: device object associated with mport
|
||||||
* @class_intf: class interface
|
|
||||||
*
|
*
|
||||||
* Removes a local mport device from the list of registered devices that provide
|
* Removes a local mport device from the list of registered devices that provide
|
||||||
* channel management services. Returns an error if the specified mport is not
|
* channel management services. Returns an error if the specified mport is not
|
||||||
* registered with the CM core.
|
* registered with the CM core.
|
||||||
*/
|
*/
|
||||||
static void riocm_remove_mport(struct device *dev,
|
static void riocm_remove_mport(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
struct rio_mport *mport = to_rio_mport(dev);
|
struct rio_mport *mport = to_rio_mport(dev);
|
||||||
struct cm_dev *cm;
|
struct cm_dev *cm;
|
||||||
|
|
|
@ -663,8 +663,7 @@ static void ses_match_to_enclosure(struct enclosure_device *edev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ses_intf_add(struct device *cdev,
|
static int ses_intf_add(struct device *cdev)
|
||||||
struct class_interface *intf)
|
|
||||||
{
|
{
|
||||||
struct scsi_device *sdev = to_scsi_device(cdev->parent);
|
struct scsi_device *sdev = to_scsi_device(cdev->parent);
|
||||||
struct scsi_device *tmp_sdev;
|
struct scsi_device *tmp_sdev;
|
||||||
|
@ -869,8 +868,7 @@ static void ses_intf_remove_enclosure(struct scsi_device *sdev)
|
||||||
enclosure_unregister(edev);
|
enclosure_unregister(edev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ses_intf_remove(struct device *cdev,
|
static void ses_intf_remove(struct device *cdev)
|
||||||
struct class_interface *intf)
|
|
||||||
{
|
{
|
||||||
struct scsi_device *sdev = to_scsi_device(cdev->parent);
|
struct scsi_device *sdev = to_scsi_device(cdev->parent);
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ static int scatter_elem_sz_prev = SG_SCATTER_SZ;
|
||||||
|
|
||||||
#define SG_SECTOR_SZ 512
|
#define SG_SECTOR_SZ 512
|
||||||
|
|
||||||
static int sg_add_device(struct device *, struct class_interface *);
|
static int sg_add_device(struct device *);
|
||||||
static void sg_remove_device(struct device *, struct class_interface *);
|
static void sg_remove_device(struct device *);
|
||||||
|
|
||||||
static DEFINE_IDR(sg_index_idr);
|
static DEFINE_IDR(sg_index_idr);
|
||||||
static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock
|
static DEFINE_RWLOCK(sg_index_lock); /* Also used to lock
|
||||||
|
@ -1488,7 +1488,7 @@ out_unlock:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sg_add_device(struct device *cl_dev, struct class_interface *cl_intf)
|
sg_add_device(struct device *cl_dev)
|
||||||
{
|
{
|
||||||
struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
|
struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
|
||||||
Sg_device *sdp = NULL;
|
Sg_device *sdp = NULL;
|
||||||
|
@ -1578,7 +1578,7 @@ sg_device_destroy(struct kref *kref)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sg_remove_device(struct device *cl_dev, struct class_interface *cl_intf)
|
sg_remove_device(struct device *cl_dev)
|
||||||
{
|
{
|
||||||
struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
|
struct scsi_device *scsidp = to_scsi_device(cl_dev->parent);
|
||||||
Sg_device *sdp = dev_get_drvdata(cl_dev);
|
Sg_device *sdp = dev_get_drvdata(cl_dev);
|
||||||
|
|
|
@ -219,8 +219,8 @@ struct class_interface {
|
||||||
struct list_head node;
|
struct list_head node;
|
||||||
const struct class *class;
|
const struct class *class;
|
||||||
|
|
||||||
int (*add_dev) (struct device *, struct class_interface *);
|
int (*add_dev) (struct device *dev);
|
||||||
void (*remove_dev) (struct device *, struct class_interface *);
|
void (*remove_dev) (struct device *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
int __must_check class_interface_register(struct class_interface *);
|
int __must_check class_interface_register(struct class_interface *);
|
||||||
|
|
|
@ -81,8 +81,7 @@ struct rtc_device *alarmtimer_get_rtcdev(void)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(alarmtimer_get_rtcdev);
|
EXPORT_SYMBOL_GPL(alarmtimer_get_rtcdev);
|
||||||
|
|
||||||
static int alarmtimer_rtc_add_device(struct device *dev,
|
static int alarmtimer_rtc_add_device(struct device *dev)
|
||||||
struct class_interface *class_intf)
|
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct rtc_device *rtc = to_rtc_device(dev);
|
struct rtc_device *rtc = to_rtc_device(dev);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user