diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 89b359b39893..f1324fe99378 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -32,18 +32,7 @@ static ssize_t modalias_show(struct device *dev, if (len != -ENODEV) return len; - len = of_device_modalias(dev, buf, PAGE_SIZE); - if (len != -ENODEV) - return len; - - if (dev->parent->parent->bus == &platform_bus_type) { - struct platform_device *pdev = - to_platform_device(dev->parent->parent); - - len = snprintf(buf, PAGE_SIZE, "platform:%s\n", pdev->name); - } - - return len; + return of_device_modalias(dev, buf, PAGE_SIZE); } static DEVICE_ATTR_RO(modalias); @@ -57,18 +46,13 @@ static int serdev_device_uevent(struct device *dev, struct kobj_uevent_env *env) { int rc; + /* TODO: platform modalias */ + rc = acpi_device_uevent_modalias(dev, env); if (rc != -ENODEV) return rc; - rc = of_device_uevent_modalias(dev, env); - if (rc != -ENODEV) - return rc; - - if (dev->parent->parent->bus == &platform_bus_type) - rc = dev->parent->parent->bus->uevent(dev, env); - - return rc; + return of_device_uevent_modalias(dev, env); } static void serdev_device_release(struct device *dev) @@ -104,17 +88,11 @@ static int serdev_device_match(struct device *dev, struct device_driver *drv) if (!is_serdev_device(dev)) return 0; + /* TODO: platform matching */ if (acpi_driver_match_device(dev, drv)) return 1; - if (of_driver_match_device(dev, drv)) - return 1; - - if (dev->parent->parent->bus == &platform_bus_type && - dev->parent->parent->bus->match(dev, drv)) - return 1; - - return 0; + return of_driver_match_device(dev, drv); } /** @@ -771,33 +749,6 @@ static inline int acpi_serdev_register_devices(struct serdev_controller *ctrl) } #endif /* CONFIG_ACPI */ -static int platform_serdev_register_devices(struct serdev_controller *ctrl) -{ - struct serdev_device *serdev; - int err; - - if (ctrl->dev.parent->bus != &platform_bus_type) - return -ENODEV; - - serdev = serdev_device_alloc(ctrl); - if (!serdev) { - dev_err(&ctrl->dev, "failed to allocate serdev device for %s\n", - dev_name(ctrl->dev.parent)); - return -ENOMEM; - } - - pm_runtime_no_callbacks(&serdev->dev); - - err = serdev_device_add(serdev); - if (err) { - dev_err(&serdev->dev, - "failure adding device. status %d\n", err); - serdev_device_put(serdev); - } - - return err; -} - /** * serdev_controller_add() - Add an serdev controller * @ctrl: controller to be registered. @@ -807,7 +758,7 @@ static int platform_serdev_register_devices(struct serdev_controller *ctrl) */ int serdev_controller_add(struct serdev_controller *ctrl) { - int ret_of, ret_acpi, ret_platform, ret; + int ret_of, ret_acpi, ret; /* Can't register until after driver model init */ if (WARN_ON(!is_registered)) @@ -821,12 +772,9 @@ int serdev_controller_add(struct serdev_controller *ctrl) ret_of = of_serdev_register_devices(ctrl); ret_acpi = acpi_serdev_register_devices(ctrl); - ret_platform = platform_serdev_register_devices(ctrl); - if (ret_of && ret_acpi && ret_platform) { - dev_dbg(&ctrl->dev, - "no devices registered: of:%pe acpi:%pe platform:%pe\n", - ERR_PTR(ret_of), ERR_PTR(ret_acpi), - ERR_PTR(ret_platform)); + if (ret_of && ret_acpi) { + dev_dbg(&ctrl->dev, "no devices registered: of:%pe acpi:%pe\n", + ERR_PTR(ret_of), ERR_PTR(ret_acpi)); ret = -ENODEV; goto err_rpm_disable; }