Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[sfrench/cifs-2.6.git] / include / linux / device.h
index 0059b99e1f25db0ef52d09bf50e1239e2fbf14e9..055a69dbcd18a8a5286d8e612fe16c1ae6245455 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/ratelimit.h>
 #include <linux/uidgid.h>
 #include <linux/gfp.h>
+#include <linux/overflow.h>
 #include <asm/device.h>
 
 struct device;
@@ -88,6 +89,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  * @resume:    Called to bring a device on this bus out of sleep mode.
  * @num_vf:    Called to find out how many virtual functions a device on this
  *             bus supports.
+ * @dma_configure:     Called to setup DMA configuration on a device on
+                       this bus.
  * @pm:                Power management operations of this bus, callback the specific
  *             device driver's pm-ops.
  * @iommu_ops:  IOMMU specific operations for this bus, used to attach IOMMU
@@ -96,8 +99,8 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  * @p:         The private data of the driver core, only the driver core can
  *             touch this.
  * @lock_key:  Lock class key for use by the lock validator
- * @force_dma: Assume devices on this bus should be set up by dma_configure()
- *             even if DMA capability is not explicitly described by firmware.
+ * @need_parent_lock:  When probing or removing a device on this bus, the
+ *                     device core should lock the device's parent.
  *
  * A bus is a channel between the processor and one or more devices. For the
  * purposes of the device model, all devices are connected via a bus, even if
@@ -130,6 +133,8 @@ struct bus_type {
 
        int (*num_vf)(struct device *dev);
 
+       int (*dma_configure)(struct device *dev);
+
        const struct dev_pm_ops *pm;
 
        const struct iommu_ops *iommu_ops;
@@ -137,7 +142,7 @@ struct bus_type {
        struct subsys_private *p;
        struct lock_class_key lock_key;
 
-       bool force_dma;
+       bool need_parent_lock;
 };
 
 extern int __must_check bus_register(struct bus_type *bus);
@@ -256,7 +261,9 @@ enum probe_type {
  *             automatically.
  * @pm:                Power management operations of the device which matched
  *             this driver.
- * @coredump:  Called through sysfs to initiate a device coredump.
+ * @coredump:  Called when sysfs entry is written to. The device driver
+ *             is expected to call the dev_coredump API resulting in a
+ *             uevent.
  * @p:         Driver core's private data, no one other than the driver
  *             core can touch this.
  *
@@ -288,7 +295,7 @@ struct device_driver {
        const struct attribute_group **groups;
 
        const struct dev_pm_ops *pm;
-       int (*coredump) (struct device *dev);
+       void (*coredump) (struct device *dev);
 
        struct driver_private *p;
 };
@@ -666,9 +673,12 @@ static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
 static inline void *devm_kmalloc_array(struct device *dev,
                                       size_t n, size_t size, gfp_t flags)
 {
-       if (size != 0 && n > SIZE_MAX / size)
+       size_t bytes;
+
+       if (unlikely(check_mul_overflow(n, size, &bytes)))
                return NULL;
-       return devm_kmalloc(dev, n * size, flags);
+
+       return devm_kmalloc(dev, bytes, flags);
 }
 static inline void *devm_kcalloc(struct device *dev,
                                 size_t n, size_t size, gfp_t flags)
@@ -902,6 +912,8 @@ struct dev_links_info {
  * @offline:   Set after successful invocation of bus type's .offline().
  * @of_node_reused: Set if the device-tree node is shared with an ancestor
  *              device.
+ * @dma_32bit_limit: bridge limited to 32bit DMA even if the device itself
+ *             indicates support for a higher limit in the dma_mask field.
  *
  * At the lowest level, every device in a Linux system is represented by an
  * instance of struct device. The device structure contains the information
@@ -990,6 +1002,7 @@ struct device {
        bool                    offline_disabled:1;
        bool                    offline:1;
        bool                    of_node_reused:1;
+       bool                    dma_32bit_limit:1;
 };
 
 static inline struct device *kobj_to_dev(struct kobject *kobj)