Commit Graph

203 Commits

Author SHA1 Message Date
Julia Lawall 8b97c7c283 drivers/atm: Use DIV_ROUND_CLOSEST
The kernel.h macro DIV_ROUND_CLOSEST performs the computation (x + d/2)/d
but is perhaps more readable.

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression x,__divisor;
@@

- (((x) + ((__divisor) / 2)) / (__divisor))
+ DIV_ROUND_CLOSEST(x,__divisor)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-02 12:54:22 -07:00
Julia Lawall 6cf5767c71 drivers/atm: Correct redundant test
str has already been tested.  It seems that this test should be on the
recently returned value snr.

A simplified version of the semantic match that finds this problem is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
expression E;
@@

if (x == NULL || ...) { ... when forall
   return ...; }
... when != \(x=E\|x--\|x++\|--x\|++x\|x-=E\|x+=E\|x|=E\|x&=E\|&x\)
(
*x == NULL
|
*x != NULL
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-27 11:38:52 -07:00
Yang Hongyang e930438c42 Replace all DMA_nBIT_MASK macro with DMA_BIT_MASK(n)
This is the second go through of the old DMA_nBIT_MASK macro,and there're not
so many of them left,so I put them into one patch.I hope this is the last round.
After this the definition of the old DMA_nBIT_MASK macro could be removed.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Tony Lindgren <tony@atomide.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Greg KH <greg@kroah.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-13 15:04:33 -07:00
Yang Hongyang 284901a90a dma-mapping: replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)
Replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-04-07 08:31:11 -07:00
Stephen Hemminger 32f3dde55b atm: fix non-const printk argument
Change printk() argument to fix compiler warning.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-03-21 19:06:51 -07:00
David S. Miller ed36604b25 Merge branch 'master' of git://git.infradead.org/~dwmw2/solos-2.6 2009-03-21 13:23:01 -07:00
David Woodhouse 1329f4550f solos: Disable DMA until we have an FPGA update with it actually implemented.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-17 15:10:51 +00:00
Nathan Williams 0fc36aa52a solos: Automatically determine number of ports
Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-17 15:01:02 +00:00
David Woodhouse 97d759d3e8 solos: Reset device on unload, free pending skbs
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-03-17 14:59:34 +00:00
David S. Miller e70049b9e7 Merge branch 'master' of /home/davem/src/GIT/linux-2.6/ 2009-02-24 03:50:29 -08:00
Roel Kluin ca1ada8861 atm: Add missing parentheses
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-18 19:35:17 -08:00
Roel Kluin 858671f80a ATM: misplaced parentheses?
Add missing parentheses

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-18 17:41:38 -08:00
Meelis Roos fcffd0d8bb fore200: fix oops on failed firmware load
Fore 200 ATM driver fails to handle request_firmware failures and oopses 
when no firmware file was found. Fix it by checking for the right return 
values and propaganting the return value up.

Signed-off-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-10 17:19:19 -08:00
Julia Lawall bc111d570b drivers/atm: introduce missing kfree
Error handling code following a kmalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,l;
position p1,p2;
expression *ptr != NULL;
@@

(
if ((x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...)) == NULL) S
|
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
)
<... when != x
     when != if (...) { <+...x...+> }
x->f = E
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-02-08 17:00:02 -08:00
David Woodhouse f87b2ed225 solos: Swap upstream/downstream rates in status packet, clean up some more
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-30 14:57:48 +11:00
David Woodhouse eab50f73ca solos: Set RX empty flag at startup only for !dma mode
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-30 14:27:26 +11:00
David Woodhouse cd5549e0f4 solos: Don't clear config registers at startup
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-30 14:26:37 +11:00
David Woodhouse 95852f48c2 solos: Tidy up status interrupt handling, cope with 'ERROR' status
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-30 14:23:52 +11:00
David Woodhouse cc3657e1f6 solos: Add 'reset' module parameter to reset the DSL chips on load
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-30 14:23:22 +11:00
David Woodhouse bdc54625b6 solos: Remove debugging, commented-out test code
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 14:37:20 +11:00
David Woodhouse 35c2221ba1 solos: Clean up handling of card->tx_mask a little
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 14:24:55 +11:00
David Woodhouse c6428e52fa solos: Fix various bugs in status packet handling
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 12:17:09 +11:00
David Woodhouse a0641cc49a solos: Remove superfluous wait_queue_head_t from struct solos_param
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 11:31:28 +11:00
David Woodhouse fcd82664cb solos: Remove IRQF_DISABLED, don't frob IRQ enable on the FPGA in solos_irq()
Neither of these are necessary.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 11:29:12 +11:00
David Woodhouse cd2169fbfb solos: Remove unused loopback debug stuff
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 11:12:58 +11:00
David Woodhouse f69e417033 solos: Tidy up tx_mask handling for ports which need TX
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 11:10:58 +11:00
David Woodhouse eaf83e3935 solos: Tidy up DMA handling a little. Still untested
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-29 10:51:11 +11:00
David Woodhouse 909372317e solos: First attempt at DMA support
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-28 16:46:56 +11:00
David Woodhouse c0fe30265a solos: Remove parameter group from sysfs on ATM dev deregister
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-28 14:34:34 +11:00
David Woodhouse 3456b22111 solos: Fix under-allocation of skb size for get/set parameters
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-28 10:39:23 +11:00
David Woodhouse af7806560c solos: Add SNR and Attn to status packet, fix oops on load
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-28 10:22:57 +11:00
David Woodhouse b28a4b9a38 solos: Reject non-AAL5 connections.... for now
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 21:50:59 +11:00
David Woodhouse 1e615df654 solos: Kill existing connections on link down event
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 21:47:47 +11:00
David Woodhouse 87ebb18627 solos: Handle new line status change packets, hook up to ATM layer info
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 20:02:30 +11:00
David Woodhouse d057f0a4ef solos: Add initial list of parameters
I don't much like the trick with multiple inclusions of solos-attrlist.c
but don't really see a saner way to do it without repeating the list.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 16:52:07 +11:00
David Woodhouse 01e2ffac7d solos: Handle attribute show/store in kernel more sanely
There are still a _lot_ of attributes, but for at least the basic ones
we want to be able to get/set them from the kernel. Especially the ones
we want to inform the ATM core about (link state, speed).

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 16:20:04 +11:00
David Woodhouse 316bea7936 solos: Kill global 'opens' count.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 14:25:16 +11:00
David Woodhouse fa755b9f2b solos: Clean up firmware loading code
We no longer try to load firmware while the ATM is up and running.
However, this means that we _do_ make init_module() wait for it, and it
takes a long time for now (since we're using ultra-conservative code in
the FPGA for that too).

The inner loop which uses swahb32p() was by Simon Farnsworth.

Simon has patches which migrate us to request_firmware_nowait(), for
which we'll actually need to take down the ATM devices, do the upgrade,
then reregister them.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 14:19:26 +11:00
Simon Farnsworth 7c4015bdff solos: FPGA and firmware update support.
This is just a straight pull in of changes, syncing us up to 0.07 from
openadsl.sf.net

Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Signed-off-by: Simon Farnsworth <simon@farnz.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 14:18:32 +11:00
Simon Farnsworth 4306cad6fe solos: Slight debugging improvements
Print a message if pskb_expand_head fails.

Make atmdebug writable by root, so that you can turn printing of data sent to
and received from the card on and off at runtime - useful for tracking
corruption.

Signed-off-by: Simon Farnsworth <simon@farnz.org.uk>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 14:18:17 +11:00
David Woodhouse b76811af76 solos: Fix length header in FPGA transfers
The length field shouldn't ever include the size of the header itself.
This fixes the problem that some people were seeing with 1500-byte
packets.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2009-01-27 10:18:51 +11:00
Wu Fengguang b67445fc17 generic swap(): iphase: rename swap() to swap_byte_order()
In preparation for the introduction of a generic swap() macro.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-01-08 08:31:14 -08:00
David Woodhouse 9c54004ea7 atm: Driver for Solos PCI ADSL2+ card.
This adds basic support for the 'Solos' PCI ADSL2+ cards being developed
by Traverse Technologies and Xrio Ltd:
http://www.traverse.com.au/productview.php?product_id=116

Signed-off-by: Nathan Williams <nathan@traverse.com.au>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-26 01:26:11 -08:00
Jiri Slaby aac725cf16 ATM: horizon, fix hrz_probe fail path
One fail path in hrz_probe omitted device disable. Fix it.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-11-29 20:42:28 -08:00
David S. Miller 56c5d900db Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	sound/core/memalloc.c
2008-10-11 12:39:35 -07:00
Julia Lawall 6a19309db0 drivers/atm: Use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

In the case of the file drivers/atm/eni.c, I am a little bit suspicious of
the -1 at the end of the affected expression.  Please check that that is
what is wanted.

An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression n,d;
@@

(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-22 19:22:58 -07:00
David S. Miller ceade961c4 atm: idt77252: Use generic SKB queue management instead of home-grown scheme.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-21 21:38:26 -07:00
David S. Miller fd098316ef sparc: Annotate of_device_id arrays with const or __initdata.
As suggested by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 01:23:17 -07:00
David S. Miller 826b6cfcd5 fore200e: Convert over to pure OF driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:14:59 -07:00
David S. Miller 63237eeb5a sparc: Move SBUS DMA attribute interfaces out of asm/sbus.h
This is in preparation for the subsequent asm/sbus.h removal.

Also, make these routines take a "struct device" or no
arguments, as appropriate.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:31 -07:00