Re: [PATCH 16/29] target/usb: Remove ifdeffed code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2012-04-06 at 10:32 +0200, Sebastian Andrzej Siewior wrote:
> * Nicholas A. Bellinger | 2012-04-05 18:21:12 [-0700]:
> 
> >On Tue, 2012-04-03 at 15:51 -0700, Andy Grover wrote:
> >> Remove ifdeffed-out code for sg support, it can go back in when sg
> >> support is ready.
> 
> Please don't merge this patch. I ifdefed a lot of code before sending
> this to Nic because I had a lot of dependencies. The sg suppor for the
> gadget framework was on Felipe's merge list for v3.5 and is merge as of
> |commit 898c60867827796f0f6f84e5de446098d776c866
> |Author: Felipe Balbi <balbi@xxxxxx>
> |Date:   Tue Nov 22 11:11:50 2011 +0200
> |
> |    usb: gadget: introduce support for sg lists
> 
> So the right patch would be removing just the "#if 0" and "#endif" line
> once this change went into the target tree.
> 

Hi Sebastian,

After the most recent update the above commit from Felipe is now present
in lio-core.git, and the extra stubs mentioned above in uas.c and bot.c
have been removed with the inline patch below..  (Please let me know if
you have any concerns)

So with that bit out of the way, the next item on the org side would be
to go ahead and get target/usb-gadget merged into a single source file
and header following what has been done with loopback, tcm_qla2xxx and
friends.  Would you mind submitting a patch to take care of this in
lio-core at your earliest convenience..?

>From there things are ready to start dropping into for-next for a
v3.5-rc merge candidate if there are no other objections from the USB
folks.  8-)

Thanks Sebastian!

--nab

commit b2decb9c5030326d5d364ef7440a35e4b75cff69
Author: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
Date:   Fri Apr 6 19:24:15 2012 -0700

    target/usb-gadget: Re-enable support for scatterlist I/O
    
    This patch removes a handful of stubs originally added by Sebastian in
    order to allow target/usb-gadget work in lio-core.git with contig buffers
    ahead of the upstream include/linux/usb/gadget.h changes to add
    scatterlists into struct usb_request here:
    
    commit 898c60867827796f0f6f84e5de446098d776c866
    Author: Felipe Balbi <balbi@xxxxxx>
    Date:   Tue Nov 22 11:11:50 2011 +0200
    
        usb: gadget: introduce support for sg lists
    
    Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
    Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

diff --git a/drivers/target/usb-gadget/bot.c b/drivers/target/usb-gadget/bot.c
index cfe968d..820faf9 100644
--- a/drivers/target/usb-gadget/bot.c
+++ b/drivers/target/usb-gadget/bot.c
@@ -182,9 +182,7 @@ int bot_send_read_response(struct usbg_cmd *cmd)
 {
        struct f_uas *fu = cmd->fu;
        struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
        struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
        int ret;
 
        if (!cmd->data_len) {
@@ -193,7 +191,7 @@ int bot_send_read_response(struct usbg_cmd *cmd)
                return 0;
        }
 
-       /* if (!gadget->sg_supported) { */
+       if (!gadget->sg_supported) {
                cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
                if (!cmd->data_buf)
                        return -ENOMEM;
@@ -204,13 +202,11 @@ int bot_send_read_response(struct usbg_cmd *cmd)
                                se_cmd->data_length);
 
                fu->bot_req_in->buf = cmd->data_buf;
-#if 0
        } else {
                fu->bot_req_in->buf = NULL;
                fu->bot_req_in->num_sgs = se_cmd->t_data_nents;
                fu->bot_req_in->sg = se_cmd->t_data_sg;
        }
-#endif
 
        fu->bot_req_in->complete = bot_read_compl;
        fu->bot_req_in->length = se_cmd->data_length;
@@ -225,9 +221,7 @@ int bot_send_write_request(struct usbg_cmd *cmd)
 {
        struct f_uas *fu = cmd->fu;
        struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
        struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
        int ret;
 
        init_completion(&cmd->write_complete);
@@ -238,19 +232,17 @@ int bot_send_write_request(struct usbg_cmd *cmd)
                return -EINVAL;
        }
 
-       /* if (!gadget->sg_supported) { */
+       if (!gadget->sg_supported) {
                cmd->data_buf = kmalloc(se_cmd->data_length, GFP_KERNEL);
                if (!cmd->data_buf)
                        return -ENOMEM;
 
                fu->bot_req_out->buf = cmd->data_buf;
-#if 0
        } else {
                fu->bot_req_out->buf = NULL;
                fu->bot_req_out->num_sgs = se_cmd->t_data_nents;
                fu->bot_req_out->sg = se_cmd->t_data_sg;
        }
-#endif
 
        fu->bot_req_out->complete = usbg_data_write_cmpl;
        fu->bot_req_out->length = se_cmd->data_length;
diff --git a/drivers/target/usb-gadget/uas.c b/drivers/target/usb-gadget/uas.c
index 0414733..1c0a199 100644
--- a/drivers/target/usb-gadget/uas.c
+++ b/drivers/target/usb-gadget/uas.c
@@ -57,13 +57,11 @@ static void uasp_status_data_cmpl(struct usb_ep *ep, struct usb_request *req);
 static int uasp_prepare_r_request(struct usbg_cmd *cmd)
 {
        struct se_cmd *se_cmd = &cmd->se_cmd;
-#if 0
        struct f_uas *fu = cmd->fu;
        struct usb_gadget *gadget = fuas_to_gadget(fu);
-#endif
        struct uas_stream *stream = cmd->stream;
 
-       /* if (!gadget->sg_supported) { */
+       if (!gadget->sg_supported) {
                cmd->data_buf = kmalloc(se_cmd->data_length, GFP_ATOMIC);
                if (!cmd->data_buf)
                        return -ENOMEM;
@@ -74,13 +72,11 @@ static int uasp_prepare_r_request(struct usbg_cmd *cmd)
                                se_cmd->data_length);
 
                stream->req_in->buf = cmd->data_buf;
-#if 0
        } else {
                stream->req_in->buf = NULL;
                stream->req_in->num_sgs = se_cmd->t_data_nents;
                stream->req_in->sg = se_cmd->t_data_sg;
        }
-#endif
 
        stream->req_in->complete = uasp_status_data_cmpl;
        stream->req_in->length = se_cmd->data_length;


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux