Am Samstag, 14. Juni 2003 01:34 schrieb Greg KH:
> On Thu, Jun 12, 2003 at 09:27:38AM +0200, Oliver Neukum wrote:
> > Hi Greg,
> >
> > this changes kaweth to use usb_buffer_alloc in the control
> > and recieve paths, in which it is using fixed buffers which
> > are not safe on some architectures. As a plus, it should
> > get a little faster on some architectures.
> > Please apply.
>
> I got the following trying to apply it:
>
> [EMAIL PROTECTED] linux-2.5-bk]$ patch -p1 -g1 --dry-run < ../u2
> drivers/usb/net/kaweth.c 1.65: 1253 lines patching file
> drivers/usb/net/kaweth.c Hunk #2 succeeded at 226 (offset 2 lines).
> Hunk #4 succeeded at 538 (offset 2 lines).
> Hunk #6 succeeded at 673 (offset 2 lines).
> Hunk #8 succeeded at 1040 (offset 2 lines).
> Hunk #9 FAILED at 1074.
> Hunk #10 FAILED at 1090.
> Hunk #11 succeeded at 1149 (offset 4 lines).
> 2 out of 11 hunks FAILED -- saving rejects to file
> drivers/usb/net/kaweth.c.rej
>
>
> And this was before applying Alan Stern's patch :)
>
> Can you re-diff this against the latest -bk tree?

This should hopefully work.

        Regards
                Oliver

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[EMAIL PROTECTED], 2003-06-14 12:16:30+02:00, [EMAIL PROTECTED]
  - switch to usb_buffer_alloc


 kaweth.c |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)


diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c  Sat Jun 14 12:18:19 2003
+++ b/drivers/usb/net/kaweth.c  Sat Jun 14 12:18:19 2003
@@ -223,13 +223,16 @@
        struct urb *rx_urb;
        struct urb *tx_urb;
        struct urb *irq_urb;
-       
+
+       dma_addr_t intbufferhandle;
+       __u8 *intbuffer;
+       dma_addr_t rxbufferhandle;
+       __u8 *rx_buf;
+
        struct sk_buff *tx_skb;
 
        __u8 *firmware_buf;
        __u8 scratch[KAWETH_SCRATCH_SIZE];
-       __u8 rx_buf[KAWETH_BUF_SIZE];
-       __u8 intbuffer[INTBUFFERSIZE];
        __u16 packet_filter_bitmap;
 
        struct kaweth_ethernet_configuration configuration;
@@ -522,6 +525,9 @@
                      KAWETH_BUF_SIZE,
                      kaweth_usb_receive,
                      kaweth);
+       kaweth->rx_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+       kaweth->rx_urb->transfer_dma = kaweth->rxbufferhandle;
+
 
        if((result = usb_submit_urb(kaweth->rx_urb, mem_flags))) {
                if (result == -ENOMEM)
@@ -530,7 +536,7 @@
        } else {
                kaweth->suspend_lowmem = 0;
        }
-       
+
        return result;
 }
 
@@ -628,6 +634,8 @@
                int_callback,
                kaweth,
                HZ/4);
+       kaweth->irq_urb->transfer_dma = kaweth->intbufferhandle;
+       kaweth->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
 
        res = usb_submit_urb(kaweth->irq_urb, GFP_KERNEL);
        if (res) {
@@ -1030,6 +1038,18 @@
        kaweth->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
        if (!kaweth->irq_urb)
                goto err_tx_and_rx;
+       kaweth->intbuffer = usb_buffer_alloc(   kaweth->dev,
+                                               INTBUFFERSIZE,
+                                               GFP_KERNEL,
+                                               &kaweth->intbufferhandle);
+       if (!kaweth->intbuffer)
+               goto err_tx_and_rx_and_irq;
+       kaweth->rx_buf = usb_buffer_alloc(      kaweth->dev,
+                                               KAWETH_BUF_SIZE,
+                                               GFP_KERNEL,
+                                               &kaweth->rxbufferhandle);
+       if (!kaweth->rx_buf)
+               goto err_all_but_rxbuf;
 
        kaweth->net = netdev;
        memcpy(kaweth->net->broadcast, &bcast_addr, sizeof(bcast_addr));
@@ -1051,12 +1071,12 @@
        kaweth->net->mtu = le16_to_cpu(kaweth->configuration.segment_size);
 
        memset(&kaweth->stats, 0, sizeof(kaweth->stats));
-       
+
        SET_MODULE_OWNER(netdev);
 
        if (!init_etherdev(netdev, 0)) {
                kaweth_err("Error calling init_etherdev.");
-               goto err_tx_and_rx;
+               goto err_all;
        }
 
        kaweth_info("kaweth interface created at %s", kaweth->net->name);
@@ -1065,7 +1085,12 @@
 
        usb_set_intfdata(intf, kaweth);
        return 0;
-
+err_all:
+       usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, 
kaweth->rxbufferhandle);
+err_all_but_rxbuf:
+       usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, 
kaweth->intbufferhandle);
+err_tx_and_rx_and_irq:
+       usb_free_urb(kaweth->irq_urb);
 err_tx_and_rx:
        usb_free_urb(kaweth->rx_urb);
 err_only_tx:
@@ -1117,6 +1142,10 @@
 
        usb_free_urb(kaweth->rx_urb);
        usb_free_urb(kaweth->tx_urb);
+       usb_free_urb(kaweth->irq_urb);
+
+       usb_buffer_free(kaweth->dev, KAWETH_BUF_SIZE, (void *)kaweth->rx_buf, 
kaweth->rxbufferhandle);
+       usb_buffer_free(kaweth->dev, INTBUFFERSIZE, (void *)kaweth->intbuffer, 
kaweth->intbufferhandle);
 
        kfree(kaweth);
 }

===================================================================


This BitKeeper patch contains the following changesets:
1.1939
## Wrapped with gzip_uu ##


begin 664 bkpatch5353
M'XL(`&OVZCX``[U6^T_:4!3^N?>ON,N2!:?`??1>VA*,*.B(+X*:)8M)4]H+
M$A[=;EMU2?_XG;:(5D3=EJTA.<UY?M\Y7X"/^"I2VC'"V>16:?01?PFCV#'@
M?9X$:E%;J&2:S&NA'D-L$(80JX=J$2Y4O2BI7VJEHGK"!(*,OA?[-QC<D6/0
M&E]YXI_?E6,,ND=7)^T!0JT6/KCQ%F-UH6+<:J'A="](U*PVU:%WDPU+5^&4
M$4(I98)P(:E(F<6YF5))A@&\!JQACX;21F.MQGM%N1_.R^6<[EMAIL PROTECTED]
M+((ZF-:HS6U,>)W(.C4Q90Z5#B?;A#F$X(+;[EMAIL PROTECTED]:QW^/^0#YN(JC
MNTF^H1`GT=`=)[EMAIL PROTECTED]/4W'X2(1]#N"W`#G7&$TT7#
M^M2[4S&L[A&Y26Q&4LXLRE,I94")Z0U]CXI`6J^LI]1UH>)2Y^P0)IQ"<)X*
MNV'27`F;*EX6QI^C?JZ1UY$*9I.&$(*ES&Y85BX9R<N"$0[G[Q`,E[C:^%^*
M*?9ZCJOZ+O^``OH;5_P':NHP)C%%O<Q(=(V,8.ZY7A!H-\:[EMAIL PROTECTED]
MX;J)A3^O_,U2NKY_,5O?9YR:T+O#.,4,]00S,4=&@;JZ"PF)'E9W8^TMHHS[
M:.:-([EMAIL PROTECTED]'[;.+P^[`[9RVW=-VO_E*+>#!+?P8+D,"#"#6C&]A
MKE%/<@[EMAIL PROTECTED]>K'==WLKGR;[EMAIL PROTECTED]:C;'63D3^_L
M<O_J$+I>]+YU'YQ'AWWWN#LXZYX\>#YM(+`%#"8C7/FP%M^"RG$(JE0:KGOO
M0KJK"P-4RS>`BO?B/6Y_[5Y^<0&S^T[$Y2.N`2[&E]#"=/#%;E[91!U*A)D=
M?6FO<X^]]&2V7)M7P-=B'@<KT3+@(.,)QQ'\4E:>,L3/N>'*;3@)\.>M,M:=
M#?H$:FOHWQI9/O_:P-4U=S8I>#ET[<#+P=G$3-:59S+?RL1+J8W--_.N__G6
=_OV*5O]\_!OE3Z-DWO)](GQ/<O0+85&C4',)````
`
end



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to