mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
![Greg Kroah-Hartman](/assets/img/avatar_default.png)
There's an effort to move the remove() callback in the driver core to not return an int, as nothing can be done if this function fails. To make that effort easier, make the aux bus remove function void to start with so that no users have to be changed sometime in the future. Cc: Dan Williams <dan.j.williams@intel.com> Cc: Dave Ertman <david.m.ertman@intel.com> Cc: Fred Oh <fred.oh@linux.intel.com> Cc: Kiran Patil <kiran.patil@intel.com> Cc: Leon Romanovsky <leonro@nvidia.com> Cc: Martin Habets <mhabets@solarflare.com> Cc: Parav Pandit <parav@mellanox.com> Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Cc: Shiraz Saleem <shiraz.saleem@intel.com> Link: https://lore.kernel.org/r/X8ohB1ks1NK7kPop@kroah.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
77 lines
2.5 KiB
C
77 lines
2.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2019-2020 Intel Corporation
|
|
*
|
|
* Please see Documentation/driver-api/auxiliary_bus.rst for more information.
|
|
*/
|
|
|
|
#ifndef _AUXILIARY_BUS_H_
|
|
#define _AUXILIARY_BUS_H_
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
struct auxiliary_device {
|
|
struct device dev;
|
|
const char *name;
|
|
u32 id;
|
|
};
|
|
|
|
struct auxiliary_driver {
|
|
int (*probe)(struct auxiliary_device *auxdev, const struct auxiliary_device_id *id);
|
|
void (*remove)(struct auxiliary_device *auxdev);
|
|
void (*shutdown)(struct auxiliary_device *auxdev);
|
|
int (*suspend)(struct auxiliary_device *auxdev, pm_message_t state);
|
|
int (*resume)(struct auxiliary_device *auxdev);
|
|
const char *name;
|
|
struct device_driver driver;
|
|
const struct auxiliary_device_id *id_table;
|
|
};
|
|
|
|
static inline struct auxiliary_device *to_auxiliary_dev(struct device *dev)
|
|
{
|
|
return container_of(dev, struct auxiliary_device, dev);
|
|
}
|
|
|
|
static inline struct auxiliary_driver *to_auxiliary_drv(struct device_driver *drv)
|
|
{
|
|
return container_of(drv, struct auxiliary_driver, driver);
|
|
}
|
|
|
|
int auxiliary_device_init(struct auxiliary_device *auxdev);
|
|
int __auxiliary_device_add(struct auxiliary_device *auxdev, const char *modname);
|
|
#define auxiliary_device_add(auxdev) __auxiliary_device_add(auxdev, KBUILD_MODNAME)
|
|
|
|
static inline void auxiliary_device_uninit(struct auxiliary_device *auxdev)
|
|
{
|
|
put_device(&auxdev->dev);
|
|
}
|
|
|
|
static inline void auxiliary_device_delete(struct auxiliary_device *auxdev)
|
|
{
|
|
device_del(&auxdev->dev);
|
|
}
|
|
|
|
int __auxiliary_driver_register(struct auxiliary_driver *auxdrv, struct module *owner,
|
|
const char *modname);
|
|
#define auxiliary_driver_register(auxdrv) \
|
|
__auxiliary_driver_register(auxdrv, THIS_MODULE, KBUILD_MODNAME)
|
|
|
|
void auxiliary_driver_unregister(struct auxiliary_driver *auxdrv);
|
|
|
|
/**
|
|
* module_auxiliary_driver() - Helper macro for registering an auxiliary driver
|
|
* @__auxiliary_driver: auxiliary driver struct
|
|
*
|
|
* Helper macro for auxiliary drivers which do not do anything special in
|
|
* module init/exit. This eliminates a lot of boilerplate. Each module may only
|
|
* use this macro once, and calling it replaces module_init() and module_exit()
|
|
*/
|
|
#define module_auxiliary_driver(__auxiliary_driver) \
|
|
module_driver(__auxiliary_driver, auxiliary_driver_register, auxiliary_driver_unregister)
|
|
|
|
struct auxiliary_device *
|
|
auxiliary_find_device(struct device *start, const void *data,
|
|
int (*match)(struct device *dev, const void *data));
|
|
|
|
#endif /* _AUXILIARY_BUS_H_ */
|