Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (4 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/include/linux/device.h

    r717 r772  
    4242
    4343        const struct dev_pm_ops *pm;
     44};
     45
     46struct device_dma_parameters {
     47        /*
     48         * a low level driver may set these to teach IOMMU code about
     49         * sg limitations.
     50         */
     51        unsigned int max_segment_size;
     52        unsigned int min_align_mask;
     53        unsigned long segment_boundary_mask;
    4454};
    4555
     
    6777  void *platform_data;
    6878  struct dev_pm_info    power;
     79        struct device_dma_parameters *dma_parms;
    6980  struct list_head      dma_pools;      /* dma pools (if dma'ble) */
    7081  struct device_driver *driver;
     82  void          *driver_data;   /* Driver data, set and get with
     83                                           dev_set_drvdata/dev_get_drvdata */
    7184  struct pm_dev *pm_dev;
    7285  char  bus_id[20];
    73   struct class          *class;
     86  const struct class            *class;
    7487  spinlock_t            devres_lock;
    7588  struct list_head      devres_head;
     
    92105static inline const char *dev_name(const struct device *dev)
    93106{
     107#if 0
    94108        /* Use the init name until the kobject becomes available */
    95109        if (dev->init_name)
     
    97111
    98112        return kobject_name(&dev->kobj);
     113#else
     114        return "uniaud32";
     115#endif
    99116}
    100117
     
    146163                                         struct bus_type *bus);
    147164
    148 #define dev_set_drvdata(dev,ptr)        ((dev)->private_data = (ptr))
    149 #define dev_get_drvdata(dev)    (dev)->private_data
    150 
    151165#define MODULE_ALIAS_CHARDEV_MAJOR(x)
    152166
     
    218232typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
    219233
    220 extern void *devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
    221                                int nid);
    222234#define NUMA_NO_NODE    (-1)
    223 static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp)
    224 {
    225         return devres_alloc_node(release, size, gfp, NUMA_NO_NODE);
    226 }
     235void *__devres_alloc_node(dr_release_t release, size_t size, gfp_t gfp,
     236                          int nid, const char *name);
     237#define devres_alloc(release, size, gfp) \
     238        __devres_alloc_node(release, size, gfp, NUMA_NO_NODE, #release)
    227239
    228240/**
     
    288300                         dr_match_t match, void *match_data);
    289301
     302/* devres group */
     303void * __must_check devres_open_group(struct device *dev, void *id, gfp_t gfp);
     304void devres_close_group(struct device *dev, void *id);
     305void devres_remove_group(struct device *dev, void *id);
     306int devres_release_group(struct device *dev, void *id);
     307
    290308/* debugging and troubleshooting/diagnostic helpers. */
    291309extern const char *dev_driver_string(const struct device *dev);
    292 #define devm_kzalloc(A, B, C) kzalloc(B, C)
    293 #define devm_kmalloc(A, B, C) kmalloc(B, C)
    294 #define devm_kcalloc(A, B, C, D) kmalloc(B, C)
    295 #define devm_kmalloc_array(A, B, C, D) kmalloc_array(B, C, D)
    296 
     310void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
     311
     312static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
     313{
     314        return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
     315}
     316
     317static inline void *devm_kmalloc_array(struct device *dev,
     318                                       size_t n, size_t size, gfp_t flags)
     319{
     320//      size_t bytes;
     321
     322//      if (unlikely(check_mul_overflow(n, size, &bytes)))
     323//              return NULL;
     324
     325        return devm_kmalloc(dev, n * size, flags);
     326}
     327static inline void *devm_kcalloc(struct device *dev,
     328                                 size_t n, size_t size, gfp_t flags)
     329{
     330        return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
     331}
    297332
    298333/* allows to add/remove a custom action to devres stack */
    299334int devm_add_action(struct device *dev, void (*action)(void *), void *data);
    300335void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
     336
     337static inline int dev_to_node(struct device *dev)
     338{
     339        return NUMA_NO_NODE;
     340}
     341
     342static inline void *dev_get_drvdata(const struct device *dev)
     343{
     344        return dev->driver_data;
     345}
     346
     347static inline void dev_set_drvdata(struct device *dev, void *data)
     348{
     349        dev->driver_data = data;
     350}
     351
     352/* Generic device matching functions that all busses can use to match with */
     353int device_match_name(struct device *dev, const void *name);
     354int device_match_of_node(struct device *dev, const void *np);
     355
     356char *devm_kasprintf(struct device *dev, gfp_t gfp,
     357                                    const char *fmt, ...);
     358
    301359#endif /* _LINUX_DEVICE_H */
    302360
Note: See TracChangeset for help on using the changeset viewer.