Commit graph

2465 commits

Author SHA1 Message Date
Alex Elder ff5f0b3822 greybus: uart-gb: improve minor device number error checking
When alloc_minor() finds an available minor device number it
does not constrain the highest number desired.  Instead, it
relies on its caller, tty_gb_probe() to see if the returned
number indicates all minor numbers have been exhausted.

There are a couple problems with this--or rather with this
code.

First, if an allocation is attempted *after* GB_NUM_MINORS
is returned, a new number greater than (but not equal to)
GB_NUM_MINORS will be allocated, and that won't produce
any error condition.

Second, alloc_minor() can return an error code (like -ENOMEM).  And
its caller is only checking for GB_NUM_MINORS.  If an error code
is returned, tty_gb_probe() simply uses it.

Change alloc_minor() so it requests minor device numbers in the
range 0..(GB_NUM_MINORS-1), and use an error return to detect
when the minor device numbers have been exhausted.

If alloc_minor() returns -ENOSPC (from idr_alloc()), translate that
to -ENODEV.  The only other error we might see is -ENOMEM, and if
we get that, return it.

Finally, zero gb_tty->minor when it's released.  (If this is
actually important a reserved value like GB_NUM_MINORS should
be used instead to signify a gb_tty with no minor assigned.)

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-08-19 05:10:42 -05:00
Greg Kroah-Hartman e68453ed28 greybus: uart-gb: now builds, more framework added 2014-08-15 19:44:32 +08:00
Greg Kroah-Hartman a18e151757 greybus: more uart work 2014-08-15 18:54:11 +08:00
Greg Kroah-Hartman ff45c265f8 greybus: uart-gb: more work on tty functions 2014-08-15 18:33:33 +08:00
Greg Kroah-Hartman 79c822be7b greybus: uart framework added, doesn't build 2014-08-15 16:01:23 +08:00
Greg Kroah-Hartman e9023d227a greybus: gpio-gb.c: it now builds properly 2014-08-12 14:41:49 +08:00
Greg Kroah-Hartman c16854c3bf greybus: gpio driver 2014-08-12 12:00:16 +08:00
Greg Kroah-Hartman d5d1903dcd greybus: add framework for 'struct gbuf'
This is the equlivant of sk_buf or urbs for Greybus.
2014-08-11 19:03:20 +08:00
Greg Kroah-Hartman 83ddaaab01 greybus: Greybus SD/MMC host driver
Need to add specifics, but this should be enough to hook up to the mmc
framework.
2014-08-11 17:27:22 +08:00
Greg Kroah-Hartman 776f136c75 greybus: greybus.h: tiny coding style cleanups 2014-08-11 17:27:07 +08:00
Greg Kroah-Hartman 53419e07cc greybus: i2c-gb: actually add the i2c adapter properly... 2014-08-11 17:01:15 +08:00
Greg Kroah-Hartman 4c009fada1 greybus: update README with info on how to build and contact me. 2014-08-11 15:44:51 +08:00
Greg Kroah-Hartman 06823c3eb9 greybus: README and .gitignore updates 2014-08-11 15:32:12 +08:00
Greg Kroah-Hartman c8a797a98c greybus: Import most recent greybus code to new repo. 2014-08-11 15:30:45 +08:00
Greg Kroah-Hartman cd26f1bd6b greybus: Initial commit 2014-08-11 15:29:23 +08:00