Thread (21 messages) 21 messages, 2 authors, 2021-09-02

Re: [PATCH net-next 08/11] ptp: ocp: Add sysfs attribute utc_tai_offset

flat view

From: Jonathan Lemon <hidden>
Date: 2021-09-02 16:57:37

On Wed, Sep 01, 2021 at 04:56:42PM -0700, Jakub Kicinski wrote:
On Mon, 30 Aug 2021 16:52:33 -0700 Jonathan Lemon wrote:
quoted
+static ssize_t
+utc_tai_offset_show(struct device *dev,
+		    struct device_attribute *attr, char *buf)
+{
+	struct ptp_ocp *bp = dev_get_drvdata(dev);
+
+	return sysfs_emit(buf, "%d\n", bp->utc_tai_offset);
+}
+
+static ssize_t
+utc_tai_offset_store(struct device *dev,
+		     struct device_attribute *attr,
+		     const char *buf, size_t count)
+{
+	struct ptp_ocp *bp = dev_get_drvdata(dev);
+	unsigned long flags;
+	int err;
+	s32 val;
+
+	err = kstrtos32(buf, 0, &val);
+	if (err)
+		return err;
+
+	bp->utc_tai_offset = val;
This line should probably be under the lock.
Ack.

BTW, I hate this entire function - but don't really 
see a better way to handle it.  One suggestion was 
to automatically get the offset from the NMEA parser,
but I can't depend on GNSS being available.
-- 
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help