Commit Graph

58 Commits (0773590c89fee9c62eaddc5459e52ba96173f930)

Author SHA1 Message Date
Uwe Kleine-König f69b0d6451 Staging: fix typos concerning "address"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-22 14:43:10 -07:00
Dan Carpenter 640f7dcfe0 Staging: sep: return -EFAULT on copy_to_user errors
copy_to_user() returns the number of bytes remaining but we want to
return a negative error code here.  These functions are used in the
ioctl handler and the error code gets returned to userspace.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-06-04 13:38:58 -07:00
Huang Weiyi 09a3c4aeb1 Staging: sep: remove duplicated #include
Remove duplicated #include('s) in
  drivers/staging/sep/sep_driver.c

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-11 11:35:36 -07:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Joe Perches c7e10c9956 Staging: Fix continuation line formats
String constants that are continued on subsequent lines with \
are not good.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:55 -08:00
Joe Perches bc56894234 Staging: Fix continuation line formats
String constants that are continued on subsequent lines with \
are not good.
Fixed a "is tryied" / tried typo

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:54 -08:00
Ben Hutchings e4c3a24dc5 Staging: sep: declare MODULE_FIRMWARE
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:43 -08:00
Ben Hutchings 4401e8243d Staging: sep: include driver name in firmware filenames
The current names "cache.image.bin" and "resident.image.bin" are far
too generic.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:43 -08:00
Németh Márton 13ac58dac0 staging: make PCI device id constant
The id_table field of the struct pci_driver is constant in <linux/pci.h>
so it is worth to make the initialization data also constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Németh Márton <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:42 -08:00
Alan Cox 74e1cd4555 Staging: sep: Fix use of legacy ioctl fop
SEP doesn't need lock_kernel.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:40 -08:00
Alan Cox db376005ab Staging: sep: Fix build problems from header changes
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-03-03 16:42:39 -08:00
André Goddard Rosa bbc9a9916b Staging: fix assorted typos all over the place
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11 12:23:20 -08:00
Randy Dunlap 727acb4fb2 Staging: sep: fix 2 warnings
Fix printk format warning:
drivers/staging/sep/sep_driver.c:276: warning: format '%08llx' expects type 'long long unsigned int', but argument 2 has type 'dma_addr_t'

and variable may be used uninitialized (correct):
drivers/staging/sep/sep_driver.c:1774: warning: 'error' may be used uninitialized in this function

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-12-11 12:23:19 -08:00
Jeff Mahoney 4439c93535 staging: Complete sched.h removal from interrupt.h
Commit d43c36dc removed sched.h from interrupt.h and distributed sched.h
to users which needed it. This finishes it up for staging.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-10-14 14:14:37 -07:00
Kamalesh Babulal 817bb33433 Staging: sep: SEP driver build breaks with CONFIG_PCI=n
next-20090813 randconfig build breaks Discretix SEP driver when
configured with CONFIG_PCI=n.

drivers/staging/sep/sep_driver.c: In function 'sep_probe':
drivers/staging/sep/sep_driver.c:2548: error: implicit declaration of function 'pci_dev_get'

This patch adds the dependency on PCI for the DX SEP driver.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 663d8bb0a9 Staging: sep: use ioremap helpers
Whee lots of code vanishes. While we are it note various existing stuff
that couldn't work but was ifdeffed in this area.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox a4e80a1bcc Staging: sep: untangle the register_fs code
While goto can be useful for cleaner cleaning up in C (as Linux sometimes
does and I think Linus borrowed stylistically from Amiga) you can overdo it.
Here is a fine fine example of when it's overkill

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox cfd498be6e Staging: sep: clean up time
The SEP time setting stuff can now get a hoover

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 2e7dcc3bbf Staging: sep: clean up command sending
Split out the debug dumping functionality. Clean up the rest. For the moment
leave the hideous cache flush in there as the code needs fixing to use
the dma_map_sg interfaces not its own crazed table functions

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 6f9e0f60c4 Staging: sep: flow ioctl cleanup
Simple ioctl taking a single numeric argument so ditch the structs and
weirdness. While we are it lock it properly and fix the error returns.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 70ae04e6cc Staging: sep: kick out various fields we can prove are not needed
#1: sep->cache_addr is assigned to sep->rar_addr and never changed
    sep->rar_addr is never assigned after this point

#2: sep->cache_bus ditto for sep->rar_bus

#3  sep->rar_region_addr is assigned but necer used

#4  sep->io_addr is in fact private to the probe function and
    the same as the reg_addr

#5  The remainig sep->io fields are in fact function locals

#6  sep->message_shared_area is assigned once from sep->shared_area
    sep->shared_area does not then change

#7  sep->shared_addr and sep->shared_area_addr are the same thing, ditto
    for the bus addresses.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 4c29e97998 Staging: sep: Implement some proper open/close methods
Use the mutex as a protection for open close rather than leaving it hanging
invalidly across userspace.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 6f13ea3df5 Staging: sep: tidy firmware load
Start by removing unused fields and then work this back to eliminate unused
chunks of the firmware loading ioctl (ie almost all of it)

Also fix the wrong handling of shared allocations and allocate the rar
region properly with dma_alloc_coherent not kmalloc, as it is device shared.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox 51faa9d27c Staging: sep: various minor tidyups
Do these in one batch rather than generate lots of tiny diffs

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:15 -07:00
Alan Cox c7b7556245 Staging: sep: fix a conversion thinko
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox ad6b9ab7a3 Staging: sep: Use the proper allocators for the shared area
The DMA handling in the driver is a bit of a catastrophe. Start with the
simple things - allocate the shared area properly.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox d7d90a269d Staging: sep: remove extra CFLAGS we don't use
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 790cf1b912 Staging: sep: Try and get kernel address and user address types right
We will need to tackle this in order to begin doing something about the
bus handled and shared memory object mess.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 3b66bb651e Staging: sep: remove module int macro
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox dabe6e6946 Staging: sep: load_rom is remarkably verbose and repetetive
Give it a haircut

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 3cacf72922 Staging: sep: fix flow API
We can return NULL - much cleaner

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 8c7ff81ac3 Staging: sep: clean up after switching to passing sep
Various function calls can now be cleaned up

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox ca605bb68c Staging: sep: Use filp->private_data to create proper device instances
Move from using a sep_dev global. The workqueue still uses it and we use the
pointer in order to know if a device was found.

This requires some restructuring as the pci probe and the init module logic
are all rather messed up and only worked by luck.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 6343cefdc8 Staging: sep: Fix PCI irq usage
Don't read the IRQ from the device, the device has no idea what is going on
in the full bus topology and remapping above PCI. Use the pdev->irq field.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:14 -07:00
Alan Cox 904290c0b7 Staging: sep: rename some fields
Make them more Linuxlike - also favour _bus over _phys

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 577092ac15 Staging: sep: use O_NDELAY instead of magic APIs
Open is still completely bogus in this driver but we'll tackle that later -
for now fix the bogus API

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 7913c21a25 Staging: sep: fix time handler
Cleaning up the code reveals an obvious thinko

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 0a18d7b5f3 Staging: sep: forward declaration removal time
Exterminate! Exterminate! Exterminate!

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 9141006647 Staging: sep: squish some of the wrapper functions
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox b636803313 Staging: sep: kill off unused code
Now it is static we can see what code is unused

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox b10b483efe Staging: sep: make everything static
Now we have it in one file we can make it all static and see what falls out

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 0097a69d55 Staging: sep: merge the two files
Now we have it trimmed down a bit merge the two pieces so we can clean it up
properly. Code moves but no changes in functions.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 8407248231 Staging: sep: kill lock wrapper
We don't need wrappers for this so clean them up

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 2f82614ca5 Staging: sep: statically initialize the fops like other drivers
This doesn't need to be done at runtime so do it at compile time

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox a2171b6807 Staging: sep: function shuffle
Shuffle the functions into a more normal order. Don't however change any of
them.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:13 -07:00
Alan Cox 8f3aa57f82 Staging: sep: Put all the ARM bits together
I suspect these can be killed off entirely

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:12 -07:00
Alan Cox 43e8c4a3ce Staging: sep: priceless ...
Remove some rather pointless goto calls

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:12 -07:00
Alan Cox f93e4bf953 Staging: sep: first pass after indent
Again all formatting

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:12 -07:00
Alan Cox d19cf32fdd Staging: sep: indent pass
Ok time to indent and get the code in vague shape. No other changes in this
patch.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:12 -07:00
Alan Cox 46eb5a13b7 Staging: sep: do something about all the printk macros
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-09-15 12:02:12 -07:00