Commit Graph

27 Commits (56835e6cc053c29bf1a15a07dbeb78f219a15214)

Author SHA1 Message Date
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
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 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 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 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 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 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
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 0eeca14f5a Staging: ipack: added support for the TEWS TPCI-200 carrier board
Driver for the carrier board TEWS TPCI-200, a bridge between PCIe bus and
IndustryPack bus.

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