|
@@ -33,6 +33,7 @@
|
|
|
#include <linux/device.h>
|
|
|
#include <linux/regulator/consumer.h>
|
|
|
#include <linux/suspend.h>
|
|
|
+#include <linux/slab.h>
|
|
|
|
|
|
#include <video/omapdss.h>
|
|
|
|
|
@@ -418,55 +419,44 @@ void omap_dss_unregister_driver(struct omap_dss_driver *dssdriver)
|
|
|
EXPORT_SYMBOL(omap_dss_unregister_driver);
|
|
|
|
|
|
/* DEVICE */
|
|
|
-static void reset_device(struct device *dev, int check)
|
|
|
-{
|
|
|
- u8 *dev_p = (u8 *)dev;
|
|
|
- u8 *dev_end = dev_p + sizeof(*dev);
|
|
|
- void *saved_pdata;
|
|
|
-
|
|
|
- saved_pdata = dev->platform_data;
|
|
|
- if (check) {
|
|
|
- /*
|
|
|
- * Check if there is any other setting than platform_data
|
|
|
- * in struct device; warn that these will be reset by our
|
|
|
- * init.
|
|
|
- */
|
|
|
- dev->platform_data = NULL;
|
|
|
- while (dev_p < dev_end) {
|
|
|
- if (*dev_p) {
|
|
|
- WARN("%s: struct device fields will be "
|
|
|
- "discarded\n",
|
|
|
- __func__);
|
|
|
- break;
|
|
|
- }
|
|
|
- dev_p++;
|
|
|
- }
|
|
|
- }
|
|
|
- memset(dev, 0, sizeof(*dev));
|
|
|
- dev->platform_data = saved_pdata;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
static void omap_dss_dev_release(struct device *dev)
|
|
|
{
|
|
|
- reset_device(dev, 0);
|
|
|
+ struct omap_dss_device *dssdev = to_dss_device(dev);
|
|
|
+ kfree(dssdev);
|
|
|
}
|
|
|
|
|
|
static int disp_num_counter;
|
|
|
|
|
|
-int omap_dss_register_device(struct omap_dss_device *dssdev,
|
|
|
- struct device *parent)
|
|
|
+struct omap_dss_device *dss_alloc_and_init_device(struct device *parent)
|
|
|
{
|
|
|
- reset_device(&dssdev->dev, 1);
|
|
|
+ struct omap_dss_device *dssdev;
|
|
|
+
|
|
|
+ dssdev = kzalloc(sizeof(*dssdev), GFP_KERNEL);
|
|
|
+ if (!dssdev)
|
|
|
+ return NULL;
|
|
|
|
|
|
dssdev->dev.bus = &dss_bus_type;
|
|
|
dssdev->dev.parent = parent;
|
|
|
dssdev->dev.release = omap_dss_dev_release;
|
|
|
dev_set_name(&dssdev->dev, "display%d", disp_num_counter++);
|
|
|
- return device_register(&dssdev->dev);
|
|
|
+
|
|
|
+ device_initialize(&dssdev->dev);
|
|
|
+
|
|
|
+ return dssdev;
|
|
|
}
|
|
|
|
|
|
-void omap_dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
+int dss_add_device(struct omap_dss_device *dssdev)
|
|
|
+{
|
|
|
+ return device_add(&dssdev->dev);
|
|
|
+}
|
|
|
+
|
|
|
+void dss_put_device(struct omap_dss_device *dssdev)
|
|
|
+{
|
|
|
+ put_device(&dssdev->dev);
|
|
|
+}
|
|
|
+
|
|
|
+void dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
{
|
|
|
device_unregister(&dssdev->dev);
|
|
|
}
|
|
@@ -474,15 +464,25 @@ void omap_dss_unregister_device(struct omap_dss_device *dssdev)
|
|
|
static int dss_unregister_dss_dev(struct device *dev, void *data)
|
|
|
{
|
|
|
struct omap_dss_device *dssdev = to_dss_device(dev);
|
|
|
- omap_dss_unregister_device(dssdev);
|
|
|
+ dss_unregister_device(dssdev);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-void omap_dss_unregister_child_devices(struct device *parent)
|
|
|
+void dss_unregister_child_devices(struct device *parent)
|
|
|
{
|
|
|
device_for_each_child(parent, NULL, dss_unregister_dss_dev);
|
|
|
}
|
|
|
|
|
|
+void dss_copy_device_pdata(struct omap_dss_device *dst,
|
|
|
+ const struct omap_dss_device *src)
|
|
|
+{
|
|
|
+ u8 *d = (u8 *)dst;
|
|
|
+ u8 *s = (u8 *)src;
|
|
|
+ size_t dsize = sizeof(struct device);
|
|
|
+
|
|
|
+ memcpy(d + dsize, s + dsize, sizeof(struct omap_dss_device) - dsize);
|
|
|
+}
|
|
|
+
|
|
|
/* BUS */
|
|
|
static int __init omap_dss_bus_register(void)
|
|
|
{
|