Re: [PATCHv3] drivers/misc: Altera active serial implementation

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jiri Slaby
Date: Monday, November 15, 2010 - 3:28 am

On 11/15/2010 11:08 AM, Baruch Siach wrote:

The answer to you previous question is here. You can just have a global
array of struct altera_as_device.


The mutex has an owner which it expects to unlock it. For example if you
fork a process which already opened the device, you have a problem. This
is a technical point. Another point is that it's ugly to leave to
userspace with any lock.


Ok, so for that count it definitely deserves its own major to not eat up
misc device space.


This cannot be done easily. You need to set drvdata prior to minor and
after all the assignments here. The former because in get_as_dev you
test minor and return drvdata. The latter because you use open_lock &
gpios after playing with minor & drvdata.

Technically, it can be done with a use of barriers, but I don't
recommend it as drivers should not use barriers at all. You should
introduce some locking here (it introduces barriers on its own).

So move the assignment to altera_as_devs below the mutex_init & gpios
setup and lock it appropriately. Then add a lock to get_as_dev.


regards,
-- 
js
suse labs
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCHv3] drivers/misc: Altera active serial implement ..., Jiri Slaby, (Mon Nov 15, 3:28 am)