]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/demo/demo-uclass.c
dm: core: Replace of_offset with accessor
[people/ms/u-boot.git] / drivers / demo / demo-uclass.c
index f6510d602c83472695065b66c0f01e55f75b881b..3341572e8a6450f8bb0ad759e15e8fdd76c7e309 100644 (file)
@@ -43,10 +43,30 @@ int demo_status(struct udevice *dev, int *status)
        return ops->status(dev, status);
 }
 
+int demo_get_light(struct udevice *dev)
+{
+       const struct demo_ops *ops = device_get_ops(dev);
+
+       if (!ops->get_light)
+               return -ENOSYS;
+
+       return ops->get_light(dev);
+}
+
+int demo_set_light(struct udevice *dev, int light)
+{
+       const struct demo_ops *ops = device_get_ops(dev);
+
+       if (!ops->set_light)
+               return -ENOSYS;
+
+       return ops->set_light(dev, light);
+}
+
 int demo_parse_dt(struct udevice *dev)
 {
        struct dm_demo_pdata *pdata = dev_get_platdata(dev);
-       int dn = dev->of_offset;
+       int dn = dev_of_offset(dev);
 
        pdata->sides = fdtdec_get_int(gd->fdt_blob, dn, "sides", 0);
        pdata->colour = fdt_getprop(gd->fdt_blob, dn, "colour", NULL);