Changeset 717 for GPL/trunk/lib32


Ignore:
Timestamp:
Aug 7, 2022, 6:11:12 PM (3 years ago)
Author:
David Azarewicz
Message:

Merge changes from next branch.

Location:
GPL/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/lib32/devres.c

    r679 r717  
    3636};
    3737
     38#define devres_log(dev, node, op)       do {} while (0)
     39
    3840/*
    3941 * Release functions for devres group.  These callbacks are used only
     
    7577
    7678#define devres_log(dev, node, op)       do {} while (0)
     79
     80static void add_dr(struct device *dev, struct devres_node *node)
     81{
     82        devres_log(dev, node, "ADD");
     83        BUG_ON(!list_empty(&node->entry));
     84//#ifndef TARGET_OS2
     85        /* Traps here on OS/2 */
     86        list_add_tail(&node->entry, &dev->devres_head);
     87//#endif
     88}
     89
     90/**
     91 * devres_add - Register device resource
     92 * @dev: Device to add resource to
     93 * @res: Resource to register
     94 *
     95 * Register devres @res to @dev.  @res should have been allocated
     96 * using devres_alloc().  On driver detach, the associated release
     97 * function will be invoked and devres will be freed automatically.
     98 */
     99void devres_add(struct device *dev, void *res)
     100{
     101        /* Traps here on OS/2 */
     102        struct devres *dr = container_of(res, struct devres, data);
     103        unsigned long flags;
     104        spin_lock_irqsave(&dev->devres_lock, flags);
     105        add_dr(dev, &dr->node);
     106        spin_unlock_irqrestore(&dev->devres_lock, flags);
     107}
    77108
    78109/**
     
    273304        return NULL;
    274305}
     306
     307/**
     308 * devm_add_action() - add a custom action to list of managed resources
     309 * @dev: Device that owns the action
     310 * @action: Function that should be called
     311 * @data: Pointer to data passed to @action implementation
     312 *
     313 * This adds a custom action to the list of managed resources so that
     314 * it gets executed as part of standard resource unwinding.
     315 */
     316int devm_add_action(struct device *dev, void (*action)(void *), void *data)
     317{
     318        return 0;
     319}
     320
     321/**
     322 * devm_remove_action() - removes previously added custom action
     323 * @dev: Device that owns the action
     324 * @action: Function implementing the action
     325 * @data: Pointer to data passed to @action implementation
     326 *
     327 * Removes instance of @action previously added by devm_add_action().
     328 * Both action and data should match one of the existing entries.
     329 */
     330void devm_remove_action(struct device *dev, void (*action)(void *), void *data)
     331{
     332}
  • GPL/trunk/lib32/driver.c

    r679 r717  
    2626#include "base.h"
    2727
    28 #define devres_log(dev, node, op)       do {} while (0)
    29 
    30 struct devres_node {
    31         struct list_head                entry;
    32         dr_release_t                    release;
    33 #ifdef CONFIG_DEBUG_DEVRES
    34         const char                      *name;
    35         size_t                          size;
    36 #endif
    37 };
    38 
    39 struct devres {
    40         struct devres_node              node;
    41         /* -- 3 pointers */
    42         unsigned long long              data[1];        /* guarantee ull alignment */
    43 };
    44 
    45 
    4628/**
    4729 * dev_set_name - set a device name
     
    6042}
    6143
    62 static void add_dr(struct device *dev, struct devres_node *node)
    63 {
    64         devres_log(dev, node, "ADD");
    65         BUG_ON(!list_empty(&node->entry));
    66         list_add_tail(&node->entry, &dev->devres_head);
    67 }
    68 
    69 /**
    70  * devres_add - Register device resource
    71  * @dev: Device to add resource to
    72  * @res: Resource to register
    73  *
    74  * Register devres @res to @dev.  @res should have been allocated
    75  * using devres_alloc().  On driver detach, the associated release
    76  * function will be invoked and devres will be freed automatically.
    77  */
    78 void devres_add(struct device *dev, void *res)
    79 {
    80         struct devres *dr = container_of(res, struct devres, data);
    81         unsigned long flags;
    82 
    83         spin_lock_irqsave(&dev->devres_lock, flags);
    84         add_dr(dev, &dr->node);
    85         spin_unlock_irqrestore(&dev->devres_lock, flags);
    86 }
     44
    8745
    8846static struct device *next_device(struct klist_iter *i)
  • GPL/trunk/lib32/pci.c

    r679 r717  
    455455
    456456/**
     457 * pcim_enable_device - Managed pci_enable_device()
     458 * @pdev: PCI device to be initialized
     459 *
     460 * Managed pci_enable_device().
     461 */
     462int pcim_enable_device(struct pci_dev *pdev)
     463{
     464        int rc;
     465
     466        rc = pci_enable_device(pdev);
     467        return rc;
     468}
     469
     470/**
    457471 *  Initialize device before it's used by a driver. Ask low-level code
    458472 *  to enable I/O and memory. Wake up the device if it was suspended.
Note: See TracChangeset for help on using the changeset viewer.