Commit Graph

52 Commits (56835e6cc053c29bf1a15a07dbeb78f219a15214)

Author SHA1 Message Date
Samuel Iglesias Gonsálvez bfce7cf686 Staging: ipack: change naming convention in TODO file
Use the ANSI/VITA 4.0-1995 (S2011) naming convention for the mezzanine or
daughter boards. They are called IP modules in the Standard.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-17 10:32:10 -07:00
Samuel Iglesias Gonsálvez 8f834c14e3 Staging: ipack: added development mailing list in TODO file
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-17 10:32:10 -07:00
Samuel Iglesias Gonsálvez 4eed84a8a4 Staging: ipack/devices/ipoctal: initialize the device in probe function
Initialize the device when registering it. Sometimes the user access to it
and the device is in an unknown state, so it could fail.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 19:11:37 -07:00
Samuel Iglesias Gonsálvez 1337b07e66 Staging: ipack/devices/ipoctal: fix dereference NULL pointer
After opening and closing the file /dev/ipoctal.X.Y.Z for the second time, it
gives a kernel oops due to a dereference of a NULL pointer.

The problem was that tty->driver_data was not properly initialized when
accessing the file for the second time.

Reported-by: Alberto Garcia Gonzalez <agarcia@igalia.com>
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-16 19:11:37 -07:00
Samuel Iglesias Gonsálvez 7183f337fe Staging: ipack/devices/ipoctal: save IRQ vector in MEM space
The IRQ vector should be saved in MEM space base address according to the
datasheet.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-06 16:21:54 -07:00
Samuel Iglesias Gonsalvez 59d6a29e55 Staging: ipack/devices/ipoctal: remove unneeded lock in IRQ handler
In the rest of the code, the data is protected with spin_lock_irqsave().

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-25 10:50:01 -07:00
Samuel Iglesias Gonsalvez bae8bd165a Staging: ipack/bridges/tpci200: remove unneeded lock in irq handler
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-25 10:50:00 -07:00
Samuel Iglesias Gonsalvez 55c0a6f470 Staging: ipack/devices/ipoctal: remove unneeded includes
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-25 10:50:00 -07:00
Samuel Iglesias Gonsalvez db1db294d9 Staging: ipack/devices/ipoctal: fix oops when accessing "buffer"
The buffer[][] field was replaced by tty_port->xmit_buf field but there was
some places that "buffer" was still accessed, giving a kernel oops because
it was uninitialized.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-25 10:50:00 -07:00
Samuel Iglesias Gonsalvez 7a2ea600fc Staging: ipack: delete sysfs from to-do list.
As we have already got rid of sysfs files in the tpci200 driver, it is needed
to delete that mention in the TODO file.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:59:27 -07:00
Samuel Iglesias Gonsalvez 14e70bfdc6 Staging: ipack: remove pr_fmt definition.
As there is no pr_* function used here, pr_fmt is not needed.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-12 10:59:26 -07:00
Miguel Gómez 3953503700 Staging: ipack/bridges/tpci200: change device table definition and export it.
Use DEFINE_PCI_DEVICE_TABLE() to create the device table and add
MODULE_DEVICE_TABLE() to export it.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:04 -07:00
Miguel Gómez 1be9bbddde Staging: ipack/devices/ipoctal: remove unused enum uart_parity_e.
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:04 -07:00
Miguel Gómez c15768bb0c Staging: ipack/devices/ipoctal: remove error_flag field from ipoctal struct.
Remove the error_flag field from the ipoctal structure, as the error code
is handled through the tty abstraction. Remove the values definition as well.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:04 -07:00
Miguel Gómez 8ae7012d3e Staging: ipack/devices/ipoctal: remove ipoctal_config structure.
The configuration of the communication channel is handled by the tty
abstraction, so the ipoctal_config structure has become useless and it's
only used to store values that are never accesed. Remove it.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:03 -07:00
Miguel Gómez ec0ceb9e42 Staging: ipack/bridges/tpci200: remove gotos in tpci200_install()
Remove the gotos when handling error conditions, as the code gets clearer
and the gotos are not really avoiding code replication.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:03 -07:00
Miguel Gómez f7986a9e73 Staging: ipack/bridges/tpci200: remove "out" label in tpci200_request_irq()
Remove the "out" label from tpci200_request_irq(), as it can directly return
the error code instead of jumping.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:03 -07:00
Miguel Gómez 14d9f9a3e1 Staging: ipack/bridges/tpci200: remove useless break in tpci200_slot_map_space()
Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:03 -07:00
Miguel Gómez 5e4be52398 Staging: ipack/bridges/tpci200: remove "out" label in tpci200_slot_map_space()
Remove the "out" label from tpci200_slot_map_space(), as it can directly return
the error code instead of jumping.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:58:02 -07:00
Miguel Gómez 7d3da090cd Staging: ipack/bridges/tpci200: remove gotos in tpci200_free_irq().
Handle error conditions with simple returns instead of usig gotos.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-09 08:57:37 -07:00
Samuel Iglesias Gonsalvez 42b38207c3 Staging: ipack/devices/ipoctal: change pr_* usage for dev_* functions
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:23:33 +09:00
Samuel Iglesias Gonsalvez a23d320370 Staging: ipack/bridges/tpci200: change pr_* usage for dev_* functions
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:23:33 +09:00
Samuel Iglesias Gonsalvez 20cf700824 Staging: ipack/bridges/tpci200: fix kernel oops when uninstalling a device
When uninstalling a device, the call to the ipack_bus_ops remove() frees
resources in the ipack device driver but without unregistering the device.

It generates a kernel oops when somebody wants to unregister the device.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:20:30 +09:00
Samuel Iglesias Gonsalvez ca2d2bb661 Staging: ipack/bridges/tpci200: avoid dereference of a freed tpci200->info
tpci200->info is used later when uninstalling the module. As there is another
kfree in the proper place, this patch removes the wrong one.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:20:30 +09:00
Samuel Iglesias Gonsalvez 597d473f16 Staging: ipack/devices/ipoctal: avoid kernel oops when uninstalling
When uninstalling a device, there is a loop of calls that produces, at the end,
two calls to __ipoctal_remove() function with the same ipack_device argument.

The first time works fine, but the second will fail in tty_unregister_driver()

To avoid this situation, the call to __ipoctal_remove() it is done only from the
ipack bus driver and not from the ipack device driver.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:20:29 +09:00
Samuel Iglesias Gonsalvez b2bc13c5e0 Staging: ipack: delete the call to remove() in ipack_driver_register
When a bus driver calls ipack_driver_register(), it should manages the returning
NULL value to undo all the operations it did before this call, and print the
corresponding trace.

It is not a task for the ipack driver to call the remove() function here.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:20:29 +09:00
Samuel Iglesias Gonsalvez 3b86bb2e11 Staging: ipack: use idr interface for numbering buses
Use idr interface to give the bus number. That way, we remove the
limitation of 64 buses.

The mutex is removed because the ida interface uses spinlocks inside, so it is
not needed an extra lock.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:20:29 +09:00
Samuel Iglesias Gonsalvez 65260291c1 Staging: ipack/bridges/tpci200: removed check of tpci200->slots[dev->slot].dev
When ipack_device_register() is called, the variable
tpci200->slots[dev->slot].dev has not assigned a value and it gives an error
when the mezzanine driver is reading a register from the board for the match()
function, as all the I/O functions call check_slot().

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:08 +09:00
Samuel Iglesias Gonsalvez 1fc75280f1 Staging: ipack/bridges/tpci200: remove name field from slot_irq
This field is not needed at all, as the IRQ is registered for the carrier not
for the mezzanine.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:08 +09:00
Samuel Iglesias Gonsalvez e149ef80b0 Staging: ipack/bridges/tpci200: fix indention.
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:08 +09:00
Samuel Iglesias Gonsalvez 786d986ea2 Staging: ipack/bridges/tpci200: check if the remove function is available
To avoid a dereference of a NULL pointer, the availability of the function is
checked before its use.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:08 +09:00
Samuel Iglesias Gonsalvez 6ad0c486a4 Staging: ipack/bridges/tpci200: tpci200_slot_map_space() should return 0 if succeed.
tpci200_slot_map_space() should return 0 if the operation was properly
done. If not, the caller will think that something wrong happened.

This patch establish the returned value to 0. It is overwritten in case of
error.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:07 +09:00
Samuel Iglesias Gonsalvez 38f1c53df2 Staging: ipack/bridges/tpci200: tpci200_slot_unmap_space() should return 0 if succeed.
tpci200_slot_unmap_space() should return 0 if the operation was properly done. If
not, the caller will think that something wrong happened.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:07 +09:00
Samuel Iglesias Gonsalvez be98cc1daa Staging: ipack: return proper value in match() function
It should return the same value given by the match function of the ipack_driver
that has been called.

Returning 0 here, means that the match has failed and it could be succeed.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:07 +09:00
Samuel Iglesias Gonsalvez 862fe87a8b Staging: ipack/bridges/tpci200: delete sysfs files
To perform the installation of a mezzanine it was needed to write on these
files, now it is not needed at all as the device model is properly implemented.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:14:06 +09:00
Sachin Kamat 7721d652c7 Staging: ipack: Remove version.h header file inclusion
version.h header file is no longer required.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-07 14:12:39 +09:00
Samuel Iglesias Gonsalvez dd8a95ed16 Staging: ipack/bridges/tpci200: remove unneeded casts
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-18 17:38:17 -07:00
Samuel Iglesias Gonsalvez c63a7dd0e5 Staging: ipack/bridges/tpci200: remove TPCI200_SHORTNAME constant
Removed TPCI200_SHORTNAME. For the pr_* the name of the module is already
included due to pr_fmt declaration.

In other cases, KBUILD_MODNAME is used instead.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-18 17:38:17 -07:00
Samuel Iglesias Gonsalvez 611b564d19 Staging: ipack: remove board_name and bus_name fields from struct ipack_device
Removed board_name and bus_name fields from struct ipack_device that are
completely useless.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-18 17:36:01 -07:00
Samuel Iglesias Gonsalvez ec440335b1 Staging: ipack: improve the register of a bus and a device in the bus.
It adds and removes some fields in the struct ipack_device and
ipack_bus_device to make it cleaner.

The API has change to group all the operations on these structures inside
of the ipack driver.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-18 17:36:01 -07:00
Samuel Iglesias Gonsalvez 5a81b4a0b6 Staging: ipack: fix a few sparse warnings
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:43:19 -07:00
Samuel Iglesias Gonsalvez 55dfd881f1 Staging: ipack: added more info in Kconfig's help about ipack
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:29 -07:00
Samuel Iglesias Gonsalvez 32254363c2 Staging: ipack/devices/ipoctal: change the licence to explicitly GPLv2
Change the licence to explicitly GPLv2 to avoid possible conflicts in the
future.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:29 -07:00
Samuel Iglesias Gonsalvez b995069af5 Staging: ipack/bridges/tpci200: change the licence to explicitly GPLv2
Change the licence to explicitly GPLv2 to avoid possible conflicts in the
future.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:29 -07:00
Samuel Iglesias Gonsalvez 416289b14a Staging: ipack: change the licence to explicitly GPLv2
Change the licence to explicitly GPLv2 to avoid possible conflicts in the
future.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:29 -07:00
Samuel Iglesias Gonsalvez 91296a28fd Staging: ipack: add contact email in TODO file
Added myself in the TODO file.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:28 -07:00
Samuel Iglesias Gonsalvez fc36f0730b Staging: ipack: move the devices source line in Kconfig file
Maintain the proper order of definitions in Kconfig following the time order of
the commits.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-14 13:41:28 -07:00
Dan Carpenter 3a745b6f47 Staging: ipack: dereferencing freed memory
We free "dev" then dereference it on the next line.

Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-10 09:50:12 -07:00
Dan Carpenter 8bdeeb26c5 Staging: ipack: returning a freed pointer
If ipack_device_register() returns an error, then we returned a freed
pointer.  The caller doesn't use it, but it means we return success to
the user instead of returning an error code.

I kind of rewrote the error handling in this function as a cleanup.

Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-10 09:50:11 -07:00
Samuel Iglesias Gonsalvez ba4dc61fe8 Staging: ipack: add support for IP-OCTAL mezzanine board
IP-OCTAL is a 8-channels serial port device. There are several models one per
each standard: RS-232, RS-422, RS-485.

This driver can manage all of them.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-09 14:16:51 -07:00