[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120816113152.73838695@pyramind.ukuu.org.uk>
Date: Thu, 16 Aug 2012 11:31:52 +0100
From: Alan Cox <alan@...rguk.ukuu.org.uk>
To: Tomas Hlavacek <tmshlvck@...il.com>
Cc: gregkh@...uxfoundation.org, alan@...ux.intel.com,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org,
marek.vasut@...il.com
Subject: Re: [PATCH 1/1] [RFC] uartclk from serial_core exposed to sysfs
> + /*
> + * Check value: baud_base has to be more than 9600
> + * and uartclock = baud_base * 16 .
> + */
> + if (val >= 153600)
> + state->uart_port->uartclk = val;
> +
> + mutex_unlock(&state->port.mutex);
> +
> + return count;
This breaks if for example the port is in use. Fixing that looks pretty
horrible as you need a valid tty pointer to stop and restart the pot.
It's also not calling the verfy method of the port as is expected.
At minimum I think you need to be able to do the same work
uart_get_info/uart_set_info perform and with the same checks on ->verify
etc.
I'm not 100% sure the drvdata on the tty_dev is clear to use. It does
seem to be in all the drivers I looked at. I'd rather however it pointed
to the tty_port that each tty device has (or very soon will be required
to have). You can still find the uart_foo structs from that but it means
we can do the dev_set_drvdata() in a consistent manner for all tty
devices in the kernel. That in turn means we can make some of the sysfs
valid the same way.
I want to have think about the setting side of it. Can you submit a
revised version that just allows the user to read the value this way but
does the drvdata setting etc and sysfs node create/delete.
I'll merge that and we can throw it over the parapet and see if anything
explodes.
To make the setting part work properly I think I need to sort out
uart_get_info/set_info so the core part of it can be called with kernel
space structures and the caller handling locks.
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists