Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6caf52a4 authored by Harvey Harrison's avatar Harvey Harrison Committed by Linus Torvalds
Browse files

net: use get/put_unaligned_* helpers



Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Auke Kok <auke-jan.h.kok@intel.com>
Cc: John Ronciak <john.ronciak@intel.com>
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 48b2cf9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1802,7 +1802,7 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
	 * it is protected by the before last buffer's el bit being set */
	if (rx->prev->skb) {
		struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
		put_unaligned(cpu_to_le32(rx->dma_addr), &prev_rfd->link);
		put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
	}

	return 0;
+1 −1
Original line number Diff line number Diff line
@@ -1508,7 +1508,7 @@ static int hamachi_rx(struct net_device *dev)
					    hmp->rx_buf_sz,
					    PCI_DMA_FROMDEVICE);
		buf_addr = (u8 *) hmp->rx_skbuff[entry]->data;
		frame_status = le32_to_cpu(get_unaligned((__le32*)&(buf_addr[data_size - 12])));
		frame_status = get_unaligned_le32(&(buf_addr[data_size - 12]));
		if (hamachi_debug > 4)
			printk(KERN_DEBUG "  hamachi_rx() status was %8.8x.\n",
				frame_status);
+1 −1
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@ static void mcs_unwrap_fir(struct mcs_cb *mcs, __u8 *buf, int len)
	}

	fcs = ~(crc32_le(~0, buf, new_len));
	if(fcs != le32_to_cpu(get_unaligned((__le32 *)(buf+new_len)))) {
	if(fcs != get_unaligned_le32(buf + new_len)) {
		IRDA_ERROR("crc error calc 0x%x len %d\n", fcs, new_len);
		mcs->stats.rx_errors++;
		mcs->stats.rx_crc_errors++;
+1 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ static void fir_eof(struct stir_cb *stir)
	}

	fcs = ~(crc32_le(~0, rx_buff->data, len));
	if (fcs != le32_to_cpu(get_unaligned((__le32 *)(rx_buff->data+len)))) {
	if (fcs != get_unaligned_le32(rx_buff->data + len)) {
		pr_debug("crc error calc 0x%x len %d\n", fcs, len);
		stir->stats.rx_errors++;
		stir->stats.rx_crc_errors++;
+17 −18
Original line number Diff line number Diff line
@@ -482,7 +482,6 @@
static char version[] __devinitdata = "de4x5.c:V0.546 2001/02/22 davies@maniac.ultranet.com\n";

#define c_char const char
#define TWIDDLE(a) (u_short)le16_to_cpu(get_unaligned((__le16 *)(a)))

/*
** MII Information
@@ -4405,7 +4404,7 @@ srom_infoleaf_info(struct net_device *dev)
	}
    }

    lp->infoleaf_offset = TWIDDLE(p+1);
	lp->infoleaf_offset = get_unaligned_le16(p + 1);

    return 0;
}
@@ -4476,7 +4475,7 @@ srom_exec(struct net_device *dev, u_char *p)

    while (count--) {
	gep_wr(((lp->chipset==DC21140) && (lp->ibn!=5) ?
		                                   *p++ : TWIDDLE(w++)), dev);
		                                   *p++ : get_unaligned_le16(w++)), dev);
	mdelay(2);                          /* 2ms per action */
    }

@@ -4711,10 +4710,10 @@ type1_infoblock(struct net_device *dev, u_char count, u_char *p)
	lp->active = *p++;
	lp->phy[lp->active].gep = (*p ? p : NULL); p += (*p + 1);
	lp->phy[lp->active].rst = (*p ? p : NULL); p += (*p + 1);
	lp->phy[lp->active].mc  = TWIDDLE(p); p += 2;
	lp->phy[lp->active].ana = TWIDDLE(p); p += 2;
	lp->phy[lp->active].fdx = TWIDDLE(p); p += 2;
	lp->phy[lp->active].ttm = TWIDDLE(p);
	lp->phy[lp->active].mc  = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].ana = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].fdx = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].ttm = get_unaligned_le16(p);
	return 0;
    } else if ((lp->media == INIT) && (lp->timeout < 0)) {
        lp->ibn = 1;
@@ -4751,16 +4750,16 @@ type2_infoblock(struct net_device *dev, u_char count, u_char *p)
	lp->infoblock_media = (*p) & MEDIA_CODE;

        if ((*p++) & EXT_FIELD) {
	    lp->cache.csr13 = TWIDDLE(p); p += 2;
	    lp->cache.csr14 = TWIDDLE(p); p += 2;
	    lp->cache.csr15 = TWIDDLE(p); p += 2;
	    lp->cache.csr13 = get_unaligned_le16(p); p += 2;
	    lp->cache.csr14 = get_unaligned_le16(p); p += 2;
	    lp->cache.csr15 = get_unaligned_le16(p); p += 2;
	} else {
	    lp->cache.csr13 = CSR13;
	    lp->cache.csr14 = CSR14;
	    lp->cache.csr15 = CSR15;
	}
        lp->cache.gepc = ((s32)(TWIDDLE(p)) << 16); p += 2;
        lp->cache.gep  = ((s32)(TWIDDLE(p)) << 16);
        lp->cache.gepc = ((s32)(get_unaligned_le16(p)) << 16); p += 2;
        lp->cache.gep  = ((s32)(get_unaligned_le16(p)) << 16);
	lp->infoblock_csr6 = OMR_SIA;
	lp->useMII = false;

@@ -4792,10 +4791,10 @@ type3_infoblock(struct net_device *dev, u_char count, u_char *p)
	if (MOTO_SROM_BUG) lp->active = 0;
	lp->phy[lp->active].gep = (*p ? p : NULL); p += (2 * (*p) + 1);
	lp->phy[lp->active].rst = (*p ? p : NULL); p += (2 * (*p) + 1);
	lp->phy[lp->active].mc  = TWIDDLE(p); p += 2;
	lp->phy[lp->active].ana = TWIDDLE(p); p += 2;
	lp->phy[lp->active].fdx = TWIDDLE(p); p += 2;
	lp->phy[lp->active].ttm = TWIDDLE(p); p += 2;
	lp->phy[lp->active].mc  = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].ana = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].fdx = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].ttm = get_unaligned_le16(p); p += 2;
	lp->phy[lp->active].mci = *p;
	return 0;
    } else if ((lp->media == INIT) && (lp->timeout < 0)) {
@@ -4835,8 +4834,8 @@ type4_infoblock(struct net_device *dev, u_char count, u_char *p)
        lp->cache.csr13 = CSR13;              /* Hard coded defaults */
	lp->cache.csr14 = CSR14;
	lp->cache.csr15 = CSR15;
        lp->cache.gepc = ((s32)(TWIDDLE(p)) << 16); p += 2;
        lp->cache.gep  = ((s32)(TWIDDLE(p)) << 16); p += 2;
        lp->cache.gepc = ((s32)(get_unaligned_le16(p)) << 16); p += 2;
        lp->cache.gep  = ((s32)(get_unaligned_le16(p)) << 16); p += 2;
	csr6 = *p++;
	flags = *p++;

Loading