Linux---driver???????????
???????????? ???????[ 2013/12/27 10:31:21 ] ?????????????? Linux
??????????????
????driver_remove_file(struct device_driver *driver?? const struct driver_attribute *attr);
??????д??????????????? ?豸??????????????????豸????????????????????????????????????????
???????裺
????1????????????豸(??????豸??????)
????2???????豸???????????? ??????豸?????????д??????
????3???????Щ??д????
??????????????д??????????ū?????????????
????1???豸????ι????????????????
????2?????????????????????豸“????????//?????????????
????3??????????????豸????????????????//match???ж????????
?????????????????--?????Щ??????? ??????豸????????????????????????? ???????????????????????????????????????? ???????
???????????????壺struct bus_type
struct bus_type {
const char
*name;/*??????????????*/
struct bus_attribute
*bus_attrs;/*????????????--?????????????*/
struct device_attribute
*dev_attrs;/*?豸?????????*/
struct driver_attribute
*drv_attrs;/*?????????????*/
int (*match)(struct device *dev?? struct device_driver *drv);/*?ж??豸????????????????*/
int (*uevent)(struct device *dev?? struct kobj_uevent_env *env);/*????????????????????*/
int (*probe)(struct device *dev);//probe???????????????????
int (*remove)(struct device *dev);/*?豸??????????*/
void (*shutdown)(struct device *dev);/*?豸??????*/
int (*suspend)(struct device *dev?? pm_message_t state);
int (*resume)(struct device *dev);
const struct dev_pm_ops *pm;
struct subsys_private *p;
};
?????豸????????:
struct device {
struct device *parent;//?????豸??
struct device_private *p;
struct kobject kobj;
const char *init_name; /* ?豸?????? */
struct device_type *type;
struct mutex mutex; /* mutex to synchronize calls to
* its driver.
*/
struct bus_type *bus; /* ?????????????? */
struct device_driver *driver; /* which driver has allocated thisdevice */
void *platform_data; /* Platform specific data?? device
core doesn't touch it */
struct dev_pm_info power;
#ifdef CONFIG_NUMA
int numa_node; /* NUMA node this device is close to */
#endif
u64 *dma_mask; /* dma mask (if dma'able device) */
u64 coherent_dma_mask;/* Like dma_mask?? but for
alloc_coherent mappings as
not all hardware supports
64 bit addresses for consistent
allocations such descriptors. */
struct device_dma_parameters *dma_parms;
struct list_head dma_pools; /* dma pools (if dma'ble) */
struct dma_coherent_mem *dma_mem; /* internal for coherent mem
override */
/* arch specific additions */
struct dev_archdata archdata;
#ifdef CONFIG_OF
struct device_node *of_node;
#endif
dev_t devt; /* dev_t?? creates the sysfs "dev" */
spinlock_t devres_lock;
struct list_head devres_head;
struct klist_node knode_class;
struct class *class;
const struct attribute_group **groups; /* optional groups */
void (*release)(struct device *dev);
};
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11