lkml.org 
[lkml]   [2017]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [v11,1/4] drivers: jtag: Add JTAG core driver
Date
> -----Original Message-----
> From: Chip Bilbrey [mailto:chip@bilbrey.org]
> Sent: Monday, November 6, 2017 12:33 AM
> To: Oleksandr Shamray <oleksandrs@mellanox.com>
> Cc: gregkh@linuxfoundation.org; arnd@arndb.de; linux-
> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; openbmc@lists.ozlabs.org; joel@jms.id.au;
> jiri@resnulli.us; tklauser@distanz.ch; linux-serial@vger.kernel.org;
> mec@shout.net; Vadim Pasternak <vadimp@mellanox.com>; system-sw-low-
> level <system-sw-low-level@mellanox.com>; robh+dt@kernel.org; openocd-
> devel-owner@lists.sourceforge.net; linux-api@vger.kernel.org;
> davem@davemloft.net; mchehab@kernel.org; Jiri Pirko <jiri@mellanox.com>
> Subject: Re: [v11,1/4] drivers: jtag: Add JTAG core driver
>
>
> Oleksandr Shamray writes:

[..]

> I notice the single-open()-per-device lock was dropped by request in an earlier
> revision of your patches, but multiple processes trying to drive a single JTAG
> master could wreak serious havoc if transactions get interleaved. Would
> something like an added JTAG_LOCKCHAIN/UNLOCKCHAIN
> ioctl() for exclusive client access be reasonable to prevent this?
>

Yes, it dropped by recommendation of Greg KH <gregkh@linuxfoundation.org>.

Greg, what you can suggest about it. May be better to add again single-open()-per-device lock with right locking way like:

>if (mutex_lock_interruptible(&jtag->open_lock)) {
> return -ERESTARTSYS;
>}
>
>if (jtag->opened) {
> mutex_unlock(&jtag->open_lock);
> return -EINVAL;
>}
>
>nonseekable_open(inode, file);
>file->private_data = jtag;
>jtag->opened++;
>mutex_unlock(&jtag->open_lock);
>

Thaks.

> -Chip

\
 
 \ /
  Last update: 2017-11-14 11:36    [W:0.065 / U:2.080 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site