linux/drivers/staging
H Hartley Sweeten 484ecc95d9 staging: comedi: cleanup all the comedi_driver 'detach' functions
1. Change the return type from int to void

All the detach functions, except for the comedi usb drivers, simply
return success (0). Plus, the return code is never checked in the
comedi core.

The comedi usb drivers do return error codes but the conditions can
never happen.

The first check is:

	if (!dev)
		return -EFAULT;

This checks that the passed comedi_device pointer is valid. The detach
function itself is called using this pointer so it MUST always be valid
or there is a bug in the core:

	if (dev->driver)
		dev->driver->detach(dev);

And the second check:

	usb = dev->private;
	if (!usb)
		return -EFAULT;

The dev->private pointer is setup in the attach function to point to the
probed usb device. This value could be NULL if the attach fails. But,
since the comedi core is going to unload the driver anyway and does not
check for errors there is no gain by returning one.

After removing these checks from the comedi usb drivers the detach
functions required a bit of cleanup.

2. Remove all the printk noise in the detach functions

All of the printk output is really just noise. The user did a rmmod to
unload the driver, we really don't need to tell them about it.

Also, some of the messages are output using:

	dev_dbg(dev->hw_dev, ...
or
	dev_info(dev->hw_dev, ...

Unfortunately the hw_dev value is only used by drivers that are doing
DMA. For most drivers this variable is going to be NULL so the output
is not going to work as expected.

3. Refactor a couple static 'free_resource' functions into the detach
   functions.

The 'free_resource' function is only being called by the detach and it
makes more sense to just absorb the code.

4. Remove a couple unnecessary braces for single statements.

5. Remove unnecessary comments.

Most of the comedi drivers appear to be based on the comedi skel driver
and have the comments from that driver included. These comments make
sense in the skel driver for reference but they don't need to be in any
of the actual drivers.

6. Remove all the extra whitespace.

It's not needed to make the functions any more readable.

7. Remove the now unused 'attached_successfully' variable in the
   cb_pcimdda driver.

This variable was only used to conditionally output some driver noise
during the detach. Since all the printk's have been removed this
variable is no longer necessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-18 17:29:55 -07:00
..
android staging: android: persistent_ram: Move to fs/pstore/ram_core.c 2012-05-17 08:50:00 -07:00
asus_oled staging: asus_oled.c: remove err() usage 2012-04-23 16:45:54 -07:00
bcm staging: replace open-coded ARRAY_SIZEs 2012-04-10 15:25:55 -07:00
comedi staging: comedi: cleanup all the comedi_driver 'detach' functions 2012-05-18 17:29:55 -07:00
cptm1217
crystalhd Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
cxt1e1 Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging 2012-01-09 12:18:17 -08:00
echo
et131x staging: et131x: Fix coding style issues 2012-05-01 21:48:44 -07:00
frontier staging: frontier: alphatrack.c: remove err() usage 2012-04-23 16:46:11 -07:00
ft1000 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
gdm72xx staging: gdm72xx depends on NET 2012-05-17 13:17:41 -07:00
iio staging: iio: add support for hmc5883/hmc5883l to hmc5843 magnetometer driver 2012-05-17 08:24:56 -07:00
ipack Staging: ipack: fix a few sparse warnings 2012-05-14 13:43:19 -07:00
keucr USB merge for 3.4-rc1 2012-03-20 11:26:30 -07:00
line6 staging: line6/config.h: Delete unused header 2012-05-18 17:13:52 -07:00
media Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
net NET: pc300, move to staging as it is broken 2012-04-13 10:57:04 -07:00
nvec staging:nvec:nvec.h Fix typos in staging:nvec 2012-04-10 09:29:21 -07:00
octeon Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
olpc_dcon staging: olpc_dcon.c: Remove a few spaces between casts and variables 2012-04-24 11:33:22 -07:00
omapdrm staging: drm/omap: initial dmabuf/prime import support 2012-05-17 08:54:09 -07:00
ozwpan Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
panel staging:panel:panel.c Fix typo in staging:panel 2012-04-10 09:29:21 -07:00
phison staging/phison: Convert pci_table entries to PCI_DEVICE (if PCI_ANY_ID is used) 2011-11-28 04:24:32 +09:00
quatech_usb2 Staging: quatech_usb3: remove err() usage 2012-04-24 09:04:42 -07:00
quickstart Staging: quickstart: Fix compilation warning on 64 bit arch 2012-02-13 20:08:56 -08:00
ramster Revert "ramster: switch over to zsmalloc and crypto interface" 2012-05-16 08:09:35 -07:00
rtl8187se staging: Remove test of is_broadcast with is_multicast 2012-05-09 13:52:23 -07:00
rtl8192e staging: Remove test of is_broadcast with is_multicast 2012-05-09 13:52:23 -07:00
rtl8192u staging: Remove test of is_broadcast with is_multicast 2012-05-09 13:52:23 -07:00
rtl8712 staging: rtl8712: Fix typo in rtl871x_io.h 2012-05-15 17:58:30 -07:00
rts5139 staging: "rts5139" Fix typos. 2012-05-14 13:31:09 -07:00
rts_pstor Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
sbe-2t3e3 Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sep Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
serqt_usb2 Staging: serqt_usb2: remove err() usage 2012-04-24 09:05:21 -07:00
slicoss staging: clean up Greg's email address in some TODO files 2012-02-15 14:45:40 -08:00
sm7xx staging: sm7xx: rename function 2012-04-29 21:32:20 -04:00
speakup TTY: speakup, do not use serialP 2012-03-08 11:47:02 -08:00
ste_rmi4 ARM: More device tree support updates 2012-03-28 12:34:33 -07:00
telephony staging/telephony/ixj.c: delete trailing whitespace 2012-04-10 10:27:58 -07:00
tidspbridge Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
usbip staging: Fix typo in multiple files 2012-04-10 10:31:01 -07:00
vme Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
vt6655 Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
vt6656 staging: Remove test of is_broadcast with is_multicast 2012-05-09 13:52:23 -07:00
winbond
wlags49_h2 Staging: wlags49_h2: potential NULL dereference 2012-05-14 15:43:44 -07:00
wlags49_h25
wlan-ng staging: wlan-ng: Release struct returned by cfg80211_inform_bss to avoid potential memory leak. 2012-04-24 11:28:25 -07:00
xgifb Merge 3.4-rc5 into staging-next 2012-05-02 11:48:07 -07:00
zcache staging: zcache: fix Kconfig crypto dependency 2012-04-24 11:57:36 -07:00
zram Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
zsmalloc staging: zsmalloc: add/fix function comment 2012-05-09 13:20:22 -07:00
Kconfig staging: gdm72xx: Add GCT GDM72xx WiMAX driver. 2012-05-15 08:49:35 -07:00
Makefile staging: gdm72xx: Add GCT GDM72xx WiMAX driver. 2012-05-15 08:49:35 -07:00
staging.c