[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190611181144.GV5016@pendragon.ideasonboard.com>
Date: Tue, 11 Jun 2019 21:11:44 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Michael Drake <michael.drake@...ethink.co.uk>
Cc: Andrzej Hajda <a.hajda@...sung.com>,
dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
linux-kernel@...ts.codethink.co.uk,
Patrick Glaser <pglaser@...la.com>, Nate Case <ncase@...la.com>
Subject: Re: [PATCH v1 07/11] ti948: Add sysfs node for alive attribute
Hi Michael,
Thank you for the patch.
On Tue, Jun 11, 2019 at 03:04:08PM +0100, Michael Drake wrote:
> This may be used by userspace to determine the state
> of the device.
Why is this needed ? Userspace shouldn't even be aware that this device
exists.
> Signed-off-by: Michael Drake <michael.drake@...ethink.co.uk>
> Cc: Patrick Glaser <pglaser@...la.com>
> Cc: Nate Case <ncase@...la.com>
> ---
> drivers/gpu/drm/bridge/ti948.c | 28 ++++++++++++++++++++++++++--
> 1 file changed, 26 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ti948.c b/drivers/gpu/drm/bridge/ti948.c
> index b5c766711c4b..b624eaeabb43 100644
> --- a/drivers/gpu/drm/bridge/ti948.c
> +++ b/drivers/gpu/drm/bridge/ti948.c
> @@ -412,6 +412,16 @@ static void ti948_alive_check(struct work_struct *work)
> schedule_delayed_work(&ti948->alive_check, TI948_ALIVE_CHECK_DELAY);
> }
>
> +static ssize_t alive_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct ti948_ctx *ti948 = ti948_ctx_from_dev(dev);
> +
> + return scnprintf(buf, PAGE_SIZE, "%u\n", (unsigned int)ti948->alive);
> +}
> +
> +static DEVICE_ATTR_RO(alive);
> +
> static int ti948_pm_resume(struct device *dev)
> {
> struct ti948_ctx *ti948 = ti948_ctx_from_dev(dev);
> @@ -614,17 +624,31 @@ static int ti948_probe(struct i2c_client *client,
>
> i2c_set_clientdata(client, ti948);
>
> + ret = device_create_file(&client->dev, &dev_attr_alive);
> + if (ret) {
> + dev_err(&client->dev, "Could not create alive attr\n");
> + return ret;
> + }
> +
> ret = ti948_pm_resume(&client->dev);
> - if (ret != 0)
> - return -EPROBE_DEFER;
> + if (ret != 0) {
> + ret = -EPROBE_DEFER;
> + goto error;
> + }
>
> dev_info(&ti948->i2c->dev, "End probe (addr: %x)\n", ti948->i2c->addr);
>
> return 0;
> +
> +error:
> + device_remove_file(&client->dev, &dev_attr_alive);
> + return ret;
> }
>
> static int ti948_remove(struct i2c_client *client)
> {
> + device_remove_file(&client->dev, &dev_attr_alive);
> +
> return ti948_pm_suspend(&client->dev);
> }
>
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists