caif: Don't resend if dev_queue_xmit fails.
[linux-2.6.git] / net / caif / cfutill.c
index ce525ca..98e027d 100644 (file)
@@ -4,6 +4,8 @@
  * License terms: GNU General Public License (GPL) version 2
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s(): " fmt, __func__
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/slab.h>
@@ -18,7 +20,7 @@
 #define UTIL_REMOTE_SHUTDOWN 0x82
 #define UTIL_FLOW_OFF 0x81
 #define UTIL_FLOW_ON  0x80
-#define UTIL_CTRL_PKT_SIZE 1
+
 static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt);
 static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt);
 
@@ -26,7 +28,7 @@ struct cflayer *cfutill_create(u8 channel_id, struct dev_info *dev_info)
 {
        struct cfsrvl *util = kmalloc(sizeof(struct cfsrvl), GFP_ATOMIC);
        if (!util) {
-               pr_warning("CAIF: %s(): Out of memory\n", __func__);
+               pr_warn("Out of memory\n");
                return NULL;
        }
        caif_assert(offsetof(struct cfsrvl, layer) == 0);
@@ -47,7 +49,7 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt)
        caif_assert(layr->up->receive != NULL);
        caif_assert(layr->up->ctrlcmd != NULL);
        if (cfpkt_extr_head(pkt, &cmd, 1) < 0) {
-               pr_err("CAIF: %s(): Packet is erroneous!\n", __func__);
+               pr_err("Packet is erroneous!\n");
                cfpkt_destroy(pkt);
                return -EPROTO;
        }
@@ -64,16 +66,14 @@ static int cfutill_receive(struct cflayer *layr, struct cfpkt *pkt)
                cfpkt_destroy(pkt);
                return 0;
        case UTIL_REMOTE_SHUTDOWN:      /* Remote Shutdown Request */
-               pr_err("CAIF: %s(): REMOTE SHUTDOWN REQUEST RECEIVED\n",
-                       __func__);
+               pr_err("REMOTE SHUTDOWN REQUEST RECEIVED\n");
                layr->ctrlcmd(layr, CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND, 0);
                service->open = false;
                cfpkt_destroy(pkt);
                return 0;
        default:
                cfpkt_destroy(pkt);
-               pr_warning("CAIF: %s(): Unknown service control %d (0x%x)\n",
-                          __func__, cmd, cmd);
+               pr_warn("Unknown service control %d (0x%x)\n", cmd, cmd);
                return -EPROTO;
        }
 }
@@ -90,12 +90,6 @@ static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt)
        if (!cfsrvl_ready(service, &ret))
                return ret;
 
-       if (cfpkt_getlen(pkt) > CAIF_MAX_PAYLOAD_SIZE) {
-               pr_err("CAIF: %s(): packet too large size=%d\n",
-                       __func__, cfpkt_getlen(pkt));
-               return -EOVERFLOW;
-       }
-
        cfpkt_add_head(pkt, &zero, 1);
        /* Add info for MUX-layer to route the packet out. */
        info = cfpkt_info(pkt);
@@ -106,10 +100,5 @@ static int cfutill_transmit(struct cflayer *layr, struct cfpkt *pkt)
         */
        info->hdr_len = 1;
        info->dev_info = &service->dev_info;
-       ret = layr->dn->transmit(layr->dn, pkt);
-       if (ret < 0) {
-               u32 tmp32;
-               cfpkt_extr_head(pkt, &tmp32, 4);
-       }
-       return ret;
+       return layr->dn->transmit(layr->dn, pkt);
 }