Commit 1b5e56ec authored by Quytelda Kahja's avatar Quytelda Kahja Committed by Greg Kroah-Hartman

Staging: gdm724x: Simplify the struct gdm_endian to a variable.

Since the testing for host endianness and in-driver conversion were
removed in 77e8a501, the gdm_endian struct contains only one member,
and can therefore be simplified to a single u8 variable.
Signed-off-by: default avatarQuytelda Kahja <quytelda@tamalin.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8db36563
......@@ -14,41 +14,33 @@
#include <linux/kernel.h>
#include "gdm_endian.h"
void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
__dev16 gdm_cpu_to_dev16(u8 dev_ed, u16 x)
{
if (dev_endian == ENDIANNESS_BIG)
ed->dev_ed = ENDIANNESS_BIG;
else
ed->dev_ed = ENDIANNESS_LITTLE;
}
__dev16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
{
if (ed->dev_ed == ENDIANNESS_LITTLE)
if (dev_ed == ENDIANNESS_LITTLE)
return (__force __dev16)cpu_to_le16(x);
else
return (__force __dev16)cpu_to_be16(x);
}
u16 gdm_dev16_to_cpu(struct gdm_endian *ed, __dev16 x)
u16 gdm_dev16_to_cpu(u8 dev_ed, __dev16 x)
{
if (ed->dev_ed == ENDIANNESS_LITTLE)
if (dev_ed == ENDIANNESS_LITTLE)
return le16_to_cpu((__force __le16)x);
else
return be16_to_cpu((__force __be16)x);
}
__dev32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
__dev32 gdm_cpu_to_dev32(u8 dev_ed, u32 x)
{
if (ed->dev_ed == ENDIANNESS_LITTLE)
if (dev_ed == ENDIANNESS_LITTLE)
return (__force __dev32)cpu_to_le32(x);
else
return (__force __dev32)cpu_to_be32(x);
}
u32 gdm_dev32_to_cpu(struct gdm_endian *ed, __dev32 x)
u32 gdm_dev32_to_cpu(u8 dev_ed, __dev32 x)
{
if (ed->dev_ed == ENDIANNESS_LITTLE)
if (dev_ed == ENDIANNESS_LITTLE)
return le32_to_cpu((__force __le32)x);
else
return be32_to_cpu((__force __be32)x);
......
......@@ -32,14 +32,9 @@ enum {
ENDIANNESS_MAX
};
struct gdm_endian {
u8 dev_ed;
};
void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian);
__dev16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x);
u16 gdm_dev16_to_cpu(struct gdm_endian *ed, __dev16 x);
__dev32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x);
u32 gdm_dev32_to_cpu(struct gdm_endian *ed, __dev32 x);
__dev16 gdm_cpu_to_dev16(u8 dev_ed, u16 x);
u16 gdm_dev16_to_cpu(u8 dev_ed, __dev16 x);
__dev32 gdm_cpu_to_dev32(u8 dev_ed, u32 x);
u32 gdm_dev32_to_cpu(u8 dev_ed, __dev32 x);
#endif /*__GDM_ENDIAN_H__*/
......@@ -685,7 +685,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, char *buf, int len)
struct net_device *dev;
struct multi_sdu *multi_sdu = (struct multi_sdu *)buf;
struct sdu *sdu = NULL;
struct gdm_endian *endian = phy_dev->get_endian(phy_dev->priv_dev);
u8 endian = phy_dev->get_endian(phy_dev->priv_dev);
u8 *data = (u8 *)multi_sdu->data;
u16 i = 0;
u16 num_packet;
......@@ -730,10 +730,9 @@ static void gdm_lte_pdn_table(struct net_device *dev, char *buf, int len)
{
struct nic *nic = netdev_priv(dev);
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
u8 ed;
if (pdn_table->activate) {
struct gdm_endian *ed;
nic->pdn_table.activate = pdn_table->activate;
ed = nic->phy_dev->get_endian(nic->phy_dev->priv_dev);
......@@ -752,9 +751,9 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, char *buf, int len)
{
struct hci_packet *hci = (struct hci_packet *)buf;
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
struct gdm_endian *endian = phy_dev->get_endian(phy_dev->priv_dev);
struct sdu *sdu;
struct net_device *dev;
u8 endian = phy_dev->get_endian(phy_dev->priv_dev);
int ret = 0;
u16 cmd_evt;
u32 nic_type;
......
......@@ -56,7 +56,7 @@ struct phy_dev {
int (*cb)(void *cb_data, void *data, int len,
int context),
void *cb_data, int context);
struct gdm_endian * (*get_endian)(void *priv_dev);
u8 (*get_endian)(void *priv_dev);
};
struct nic {
......
......@@ -72,8 +72,8 @@ static int request_mac_address(struct lte_udev *udev)
int actual;
int ret = -1;
hci->cmd_evt = gdm_cpu_to_dev16(&udev->gdm_ed, LTE_GET_INFORMATION);
hci->len = gdm_cpu_to_dev16(&udev->gdm_ed, 1);
hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION);
hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1);
hci->data[0] = MAC_ADDRESS;
ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5,
......@@ -410,7 +410,7 @@ static void do_rx(struct work_struct *work)
phy_dev = r->cb_data;
udev = phy_dev->priv_dev;
hci = (struct hci_packet *)r->buf;
cmd_evt = gdm_dev16_to_cpu(&udev->gdm_ed, hci->cmd_evt);
cmd_evt = gdm_dev16_to_cpu(udev->gdm_ed, hci->cmd_evt);
switch (cmd_evt) {
case LTE_GET_INFORMATION_RESULT:
......@@ -604,7 +604,7 @@ static u32 packet_aggregation(struct lte_udev *udev, u8 *send_buf)
u16 num_packet = 0;
unsigned long flags;
multi_sdu->cmd_evt = gdm_cpu_to_dev16(&udev->gdm_ed, LTE_TX_MULTI_SDU);
multi_sdu->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_TX_MULTI_SDU);
while (num_packet < MAX_PACKET_IN_MULTI_SDU) {
spin_lock_irqsave(&tx->lock, flags);
......@@ -635,8 +635,8 @@ static u32 packet_aggregation(struct lte_udev *udev, u8 *send_buf)
spin_unlock_irqrestore(&tx->lock, flags);
}
multi_sdu->len = gdm_cpu_to_dev16(&udev->gdm_ed, send_len);
multi_sdu->num_packet = gdm_cpu_to_dev16(&udev->gdm_ed, num_packet);
multi_sdu->len = gdm_cpu_to_dev16(udev->gdm_ed, send_len);
multi_sdu->num_packet = gdm_cpu_to_dev16(udev->gdm_ed, num_packet);
return send_len + offsetof(struct multi_sdu, data);
}
......@@ -735,7 +735,7 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
}
sdu = (struct sdu *)t_sdu->buf;
sdu->cmd_evt = gdm_cpu_to_dev16(&udev->gdm_ed, LTE_TX_SDU);
sdu->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_TX_SDU);
if (nic_type == NIC_TYPE_ARP) {
send_len = len + SDU_PARAM_LEN;
memcpy(sdu->data, data, len);
......@@ -745,10 +745,10 @@ static int gdm_usb_sdu_send(void *priv_dev, void *data, int len,
memcpy(sdu->data, data + ETH_HLEN, len - ETH_HLEN);
}
sdu->len = gdm_cpu_to_dev16(&udev->gdm_ed, send_len);
sdu->dft_eps_ID = gdm_cpu_to_dev32(&udev->gdm_ed, dft_eps_ID);
sdu->bearer_ID = gdm_cpu_to_dev32(&udev->gdm_ed, eps_ID);
sdu->nic_type = gdm_cpu_to_dev32(&udev->gdm_ed, nic_type);
sdu->len = gdm_cpu_to_dev16(udev->gdm_ed, send_len);
sdu->dft_eps_ID = gdm_cpu_to_dev32(udev->gdm_ed, dft_eps_ID);
sdu->bearer_ID = gdm_cpu_to_dev32(udev->gdm_ed, eps_ID);
sdu->nic_type = gdm_cpu_to_dev32(udev->gdm_ed, nic_type);
t_sdu->len = send_len + HCI_HEADER_SIZE;
t_sdu->callback = cb;
......@@ -799,11 +799,11 @@ static int gdm_usb_hci_send(void *priv_dev, void *data, int len,
return 0;
}
static struct gdm_endian *gdm_usb_get_endian(void *priv_dev)
static u8 gdm_usb_get_endian(void *priv_dev)
{
struct lte_udev *udev = priv_dev;
return &udev->gdm_ed;
return udev->gdm_ed;
}
static int gdm_usb_probe(struct usb_interface *intf,
......@@ -859,9 +859,9 @@ static int gdm_usb_probe(struct usb_interface *intf,
* defaults to little endian
*/
if (idProduct == PID_GDM7243)
gdm_set_endian(&udev->gdm_ed, ENDIANNESS_BIG);
udev->gdm_ed = ENDIANNESS_BIG;
else
gdm_set_endian(&udev->gdm_ed, ENDIANNESS_LITTLE);
udev->gdm_ed = ENDIANNESS_LITTLE;
ret = request_mac_address(udev);
if (ret < 0) {
......
......@@ -93,11 +93,11 @@ struct rx_cxt {
struct lte_udev {
struct usb_device *usbdev;
struct gdm_endian gdm_ed;
struct tx_cxt tx;
struct rx_cxt rx;
struct delayed_work work_tx;
struct delayed_work work_rx;
u8 gdm_ed;
u8 send_complete;
u8 tx_stop;
struct usb_interface *intf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment