lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 11 Jun 2019 15:04:08 +0100
From:   Michael Drake <michael.drake@...ethink.co.uk>
To:     Andrzej Hajda <a.hajda@...sung.com>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Michael Drake <michael.drake@...ethink.co.uk>
Cc:     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: [PATCH v1 07/11] ti948: Add sysfs node for alive attribute

This may be used by userspace to determine the state
of the device.

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);
 }
 
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ