From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751888AbcGRMOr (ORCPT ); Mon, 18 Jul 2016 08:14:47 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:57802 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbcGRMOp (ORCPT ); Mon, 18 Jul 2016 08:14:45 -0400 Date: Mon, 18 Jul 2016 13:14:27 +0100 From: Mark Brown To: Geert Uytterhoeven Cc: Rob Herring , Mark Rutland , Magnus Damm , Hisashi Nakamura , Hiromitsu Yamasaki , linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20160718121427.GS30372@sirena.org.uk> References: <1466602929-4191-1-git-send-email-geert+renesas@glider.be> <1466602929-4191-5-git-send-email-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GFHULmA0mO3kKGOo" Content-Disposition: inline In-Reply-To: <1466602929-4191-5-git-send-email-geert+renesas@glider.be> X-Cookie: It's later than you think. User-Agent: Mutt/1.6.0 (2016-04-01) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [PATCH/RFC 4/6] spi: slave: Add SPI slave handler reporting boot up time X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --GFHULmA0mO3kKGOo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 22, 2016 at 03:42:07PM +0200, Geert Uytterhoeven wrote: > Add an SPI slave handler responding with the time of reception of the > last SPI message. >=20 > This can be used by an external microcontroller as a dead man's switch. The subject says boot up time, this says time of reception of the last message. Which is it? > +static int spi_slave_time_send(struct spi_device *spi) > +{ > + __be32 msg[2]; > + u32 rem_ns; > + u64 ts; > + > + ts =3D local_clock(); > + rem_ns =3D do_div(ts, 1000000000) / 1000; > + > + msg[0] =3D cpu_to_be32(ts); > + msg[1] =3D cpu_to_be32(rem_ns); > + > + return spi_write(spi, &msg, sizeof(msg)); > +} Looks like uptime which is a third thing. > +static int spi_slave_time_remove(struct spi_device *spi) > +{ > + struct spi_slave_time_priv *priv =3D spi_get_drvdata(spi); > + > + /* FIXME Doesn't work, as spi_write() is blocked on a completion */ > + kthread_stop(priv->thread); spi_async()? Still no cancellation on the actual operation but it pushes it more inside the framework. --GFHULmA0mO3kKGOo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXjMgiAAoJECTWi3JdVIfQxN8H/iTfhmcWrE0RQpPOF9FQ4WLA 45W5GkH13mncePGwfWt4pHlpWfCSRp6E0c2gYKJqd+QA7OZOBihaLJEpLY0Fc8pJ 5qv0bYjCIb8fQcqrmUYo4KkzkgchEqIZ+OlHmTAgWPyOiiDS/doGxPzgjQK3W8XO EJijsscQXazBrgEjGlqpiJ6U/jRXi/qELJ8UUlfqYV7QdCHV2IUl2yaRghgOQNMf 3uQ59kL9E4tzWLZywxpwkL5HOHL16dAZRphxs//IYgWE/a6KHxKuN3e7kcuDGiwZ KoTankimBu9HW4v7/8IGxwCg6RywDVRkl4seau7QwFTpyrlTeRwY75og0ixB+1I= =tjIp -----END PGP SIGNATURE----- --GFHULmA0mO3kKGOo--