> -----Original Message----- > From: Chip Bilbrey [mailto:chip@xxxxxxxxxxx] > Sent: Monday, November 6, 2017 12:33 AM > To: Oleksandr Shamray <oleksandrs@xxxxxxxxxxxx> > Cc: gregkh@xxxxxxxxxxxxxxxxxxx; arnd@xxxxxxxx; linux- > kernel@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; > devicetree@xxxxxxxxxxxxxxx; openbmc@xxxxxxxxxxxxxxxx; joel@xxxxxxxxx; > jiri@xxxxxxxxxxx; tklauser@xxxxxxxxxx; linux-serial@xxxxxxxxxxxxxxx; > mec@xxxxxxxxx; Vadim Pasternak <vadimp@xxxxxxxxxxxx>; system-sw-low- > level <system-sw-low-level@xxxxxxxxxxxx>; robh+dt@xxxxxxxxxx; openocd- > devel-owner@xxxxxxxxxxxxxxxxxxxxx; linux-api@xxxxxxxxxxxxxxx; > davem@xxxxxxxxxxxxx; mchehab@xxxxxxxxxx; Jiri Pirko <jiri@xxxxxxxxxxxx> > 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@xxxxxxxxxxxxxxxxxxx>. 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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html