Re: Patch: Fix serial module use count (2.4.16 _and_ 2.5)

Russell King (rmk@arm.linux.org.uk)
Thu, 29 Nov 2001 16:17:56 +0000


On Thu, Nov 29, 2001 at 08:06:37AM -0800, Balbir Singh wrote:
> Let me make it clearer to you,
>
> lets say I call rs_open() on /dev/ttyS0 and if it
> fails then I should not call rs_close() after a failed
> rs_open().

You don't call rs_open. The tty layer does that for you. The tty layer
also cleans up on close by calling the driver specific close function.

Yes I agree with you that it might not, but that is a 2.5 kernel issue,
not a 2.4 "lets do a massive change" issue. The tty layer is complex
and messy, and we shouldn't go around randomly changing it in 2.4.

> Lets see what happens with your approach
>
> 1. I call rs_open(), it fails, ref_count set to 1

Ok, so you're poking around in kernel code calling kernel functions that
were previously declared static and not visible to anything but the tty
layer. That immediately makes your example invalid because you're not
following the rules that the tty layers lays down for opening tty devices.

--
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/