~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/mdev.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/mdev.h (Version linux-6.12-rc7) and /include/linux/mdev.h (Version linux-6.0.19)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*                                                  2 /*
  3  * Mediated device definition                       3  * Mediated device definition
  4  *                                                  4  *
  5  * Copyright (c) 2016, NVIDIA CORPORATION. All      5  * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
  6  *     Author: Neo Jia <cjia@nvidia.com>            6  *     Author: Neo Jia <cjia@nvidia.com>
  7  *             Kirti Wankhede <kwankhede@nvidi      7  *             Kirti Wankhede <kwankhede@nvidia.com>
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef MDEV_H                                     10 #ifndef MDEV_H
 11 #define MDEV_H                                     11 #define MDEV_H
 12                                                    12 
 13 #include <linux/device.h>                      << 
 14 #include <linux/uuid.h>                        << 
 15                                                << 
 16 struct mdev_type;                                  13 struct mdev_type;
 17                                                    14 
 18 struct mdev_device {                               15 struct mdev_device {
 19         struct device dev;                         16         struct device dev;
 20         guid_t uuid;                               17         guid_t uuid;
 21         struct list_head next;                     18         struct list_head next;
 22         struct mdev_type *type;                    19         struct mdev_type *type;
 23         bool active;                               20         bool active;
 24 };                                                 21 };
 25                                                    22 
 26 struct mdev_type {                             << 
 27         /* set by the driver before calling md << 
 28         const char *sysfs_name;                << 
 29         const char *pretty_name;               << 
 30                                                << 
 31         /* set by the core, can be used driver << 
 32         struct mdev_parent *parent;            << 
 33                                                << 
 34         /* internal only */                    << 
 35         struct kobject kobj;                   << 
 36         struct kobject *devices_kobj;          << 
 37 };                                             << 
 38                                                << 
 39 /* embedded into the struct device that the md << 
 40 struct mdev_parent {                           << 
 41         struct device *dev;                    << 
 42         struct mdev_driver *mdev_driver;       << 
 43         struct kset *mdev_types_kset;          << 
 44         /* Synchronize device creation/removal << 
 45         struct rw_semaphore unreg_sem;         << 
 46         struct mdev_type **types;              << 
 47         unsigned int nr_types;                 << 
 48         atomic_t available_instances;          << 
 49 };                                             << 
 50                                                << 
 51 static inline struct mdev_device *to_mdev_devi     23 static inline struct mdev_device *to_mdev_device(struct device *dev)
 52 {                                                  24 {
 53         return container_of(dev, struct mdev_d     25         return container_of(dev, struct mdev_device, dev);
 54 }                                                  26 }
 55                                                    27 
                                                   >>  28 unsigned int mdev_get_type_group_id(struct mdev_device *mdev);
                                                   >>  29 unsigned int mtype_get_type_group_id(struct mdev_type *mtype);
                                                   >>  30 struct device *mtype_get_parent_dev(struct mdev_type *mtype);
                                                   >>  31 
                                                   >>  32 /* interface for exporting mdev supported type attributes */
                                                   >>  33 struct mdev_type_attribute {
                                                   >>  34         struct attribute attr;
                                                   >>  35         ssize_t (*show)(struct mdev_type *mtype,
                                                   >>  36                         struct mdev_type_attribute *attr, char *buf);
                                                   >>  37         ssize_t (*store)(struct mdev_type *mtype,
                                                   >>  38                          struct mdev_type_attribute *attr, const char *buf,
                                                   >>  39                          size_t count);
                                                   >>  40 };
                                                   >>  41 
                                                   >>  42 #define MDEV_TYPE_ATTR(_name, _mode, _show, _store)             \
                                                   >>  43 struct mdev_type_attribute mdev_type_attr_##_name =             \
                                                   >>  44         __ATTR(_name, _mode, _show, _store)
                                                   >>  45 #define MDEV_TYPE_ATTR_RW(_name) \
                                                   >>  46         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RW(_name)
                                                   >>  47 #define MDEV_TYPE_ATTR_RO(_name) \
                                                   >>  48         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_RO(_name)
                                                   >>  49 #define MDEV_TYPE_ATTR_WO(_name) \
                                                   >>  50         struct mdev_type_attribute mdev_type_attr_##_name = __ATTR_WO(_name)
                                                   >>  51 
 56 /**                                                52 /**
 57  * struct mdev_driver - Mediated device driver     53  * struct mdev_driver - Mediated device driver
 58  * @device_api: string to return for the devic << 
 59  * @max_instances: maximum number of instances << 
 60  * @probe: called when new device created          54  * @probe: called when new device created
 61  * @remove: called when device removed             55  * @remove: called when device removed
 62  * @get_available: Return the max number of in !!  56  * @supported_type_groups: Attributes to define supported types. It is mandatory
 63  * @show_description: Print a description of t !!  57  *                      to provide supported types.
 64  * @driver: device driver structure                58  * @driver: device driver structure
                                                   >>  59  *
 65  **/                                               60  **/
 66 struct mdev_driver {                               61 struct mdev_driver {
 67         const char *device_api;                << 
 68         unsigned int max_instances;            << 
 69         int (*probe)(struct mdev_device *dev);     62         int (*probe)(struct mdev_device *dev);
 70         void (*remove)(struct mdev_device *dev     63         void (*remove)(struct mdev_device *dev);
 71         unsigned int (*get_available)(struct m !!  64         struct attribute_group **supported_type_groups;
 72         ssize_t (*show_description)(struct mde << 
 73         struct device_driver driver;               65         struct device_driver driver;
 74 };                                                 66 };
 75                                                    67 
 76 int mdev_register_parent(struct mdev_parent *p !!  68 extern struct bus_type mdev_bus_type;
 77                 struct mdev_driver *mdev_drive !!  69 
 78                 unsigned int nr_types);        !!  70 int mdev_register_device(struct device *dev, struct mdev_driver *mdev_driver);
 79 void mdev_unregister_parent(struct mdev_parent !!  71 void mdev_unregister_device(struct device *dev);
 80                                                    72 
 81 int mdev_register_driver(struct mdev_driver *d     73 int mdev_register_driver(struct mdev_driver *drv);
 82 void mdev_unregister_driver(struct mdev_driver     74 void mdev_unregister_driver(struct mdev_driver *drv);
 83                                                    75 
                                                   >>  76 struct device *mdev_parent_dev(struct mdev_device *mdev);
 84 static inline struct device *mdev_dev(struct m     77 static inline struct device *mdev_dev(struct mdev_device *mdev)
 85 {                                                  78 {
 86         return &mdev->dev;                         79         return &mdev->dev;
                                                   >>  80 }
                                                   >>  81 static inline struct mdev_device *mdev_from_dev(struct device *dev)
                                                   >>  82 {
                                                   >>  83         return dev->bus == &mdev_bus_type ? to_mdev_device(dev) : NULL;
 87 }                                                  84 }
 88                                                    85 
 89 #endif /* MDEV_H */                                86 #endif /* MDEV_H */
 90                                                    87 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php