0
0
Fork 0

fix compilation and errors with newer versions of the kernel

This commit is contained in:
Daryl Ronningen 2023-10-07 18:31:22 -07:00
parent 2c7206d671
commit 15e9a9a80e
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
4 changed files with 12 additions and 7 deletions

View file

@ -459,7 +459,12 @@ static struct hgicf_vif *hgicf_create_iface(struct hgicf_wdev *hg)
vif->hg = hg;
vif->state = 0;
ndev->needed_headroom += (hg->bus->drv_tx_headroom + sizeof(struct hgic_frm_hdr2));
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
memcpy(ndev->dev_addr, hg->fwinfo.mac, ETH_ALEN);
#else
eth_hw_addr_set(ndev, hg->fwinfo.mac);
#endif
ret = register_netdev(ndev);
if (ret) {
free_netdev(ndev);
@ -507,11 +512,7 @@ static int hgicf_rx_data(void *hgobj, struct sk_buff *skb, int len)
}
skb_pull(skb, sizeof(struct hgic_frm_hdr2));
skb->protocol = eth_type_trans(skb, skb->dev);
if (in_interrupt()) {
netif_rx(skb);
} else {
netif_rx_ni(skb);
}
netif_rx(skb);
break;
case HGIC_HDR_TYPE_CMD:
case HGIC_HDR_TYPE_CMD2:

View file

@ -7,6 +7,10 @@
#include "hgicf.h"
#include "cfg.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 16, 0)
#define PDE_DATA(inode) pde_data(inode)
#endif
static int hgicf_signal_show(struct seq_file *seq, void *v)
{
struct hgicf_wdev *hg = (struct hgicf_wdev *)seq->private;

View file

@ -266,7 +266,7 @@ int hgic_bootdl_cmd_enter(struct hgic_bootdl *hg)
skb = hgic_bootdl_alloc_cmd_skb(hg, HG_BOOTDL_CMD_ENTER);
if (skb) {
cmd_hdr = (struct hgic_bootdl_cmd_hdr *)skb->data;
memcpy((void *)cmd_hdr->addr, (void *)BOOT_CMD_KEY, BOOT_CMD_KEY_SIZE);
memcpy((void *)cmd_hdr->addr, (void *)BOOT_CMD_KEY, sizeof(cmd_hdr->addr));
cmd_hdr->check = hgic_bootdl_cmd_check_val(hg->checksum_mode, (u8 *)&cmd_hdr->cmd, 11);
} else {
hgic_err("malloc skb failed!\n");

View file

@ -80,7 +80,7 @@ const struct sdio_device_id_t hgic_sdio_wdev_ids[] = {
#define SDIO_CAP_POLL(func) ((func)->card->host->caps & MMC_CAP_NEEDS_POLL)
#define HOST_SPI_CRC(func, crc) (func)->card->host->use_spi_crc=crc
//#define mmc_card_disable_cd(c) (1)
#define mmc_card_disable_cd(c) (1)
#define hgic_card_disable_cd(func) mmc_card_disable_cd((func)->card)
#define hgic_card_set_highspeed(func) mmc_card_set_highspeed((func)->card)
#define hgic_host_is_spi(func) mmc_host_is_spi((func)->card->host)