From: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> To: netdev@vger.kernel.org Cc: davem@davemloft.net, intel-wired-lan@lists.osuosl.org, jesse.brandeburg@intel.com, Vincenzo Palazzo <vincenzopalazzodev@gmail.com>, Linus Torvalds <torvalds@linux-foundation.org> Subject: [PATCH v1] netdevice: use ifmap isteand of plain fields Date: Fri, 3 Mar 2023 16:08:18 +0100 [thread overview] Message-ID: <20230303150818.132386-1-vincenzopalazzodev@gmail.com> (raw) clean the code by using the ifmap instead of plain fields, and avoid code duplication. P.S: I'm giving credit to the author of the FIXME commit. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> --- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- include/linux/netdevice.h | 8 +------- net/core/dev_ioctl.c | 12 ++++++------ net/core/rtnetlink.c | 6 +++--- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e1eb1de88bf9..059ff8bcdbbc 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -7476,8 +7476,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netif_napi_add(netdev, &adapter->napi, e1000e_poll); strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); - netdev->mem_start = mmio_start; - netdev->mem_end = mmio_start + mmio_len; + netdev->dev_mapping.mem_start = mmio_start; + netdev->dev_mapping.mem_end = mmio_start + mmio_len; adapter->bd_number = cards_found++; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6a14b7b11766..c5987e90a078 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2031,13 +2031,7 @@ struct net_device { char name[IFNAMSIZ]; struct netdev_name_node *name_node; struct dev_ifalias __rcu *ifalias; - /* - * I/O specific fields - * FIXME: Merge these and struct ifmap into one - */ - unsigned long mem_end; - unsigned long mem_start; - unsigned long base_addr; + struct ifmap dev_mapping; /* * Some hardware also needs these fields (state,dev_list, diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 5cdbfbf9a7dc..89469cb97e35 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -88,9 +88,9 @@ static int dev_getifmap(struct net_device *dev, struct ifreq *ifr) if (in_compat_syscall()) { struct compat_ifmap *cifmap = (struct compat_ifmap *)ifmap; - cifmap->mem_start = dev->mem_start; - cifmap->mem_end = dev->mem_end; - cifmap->base_addr = dev->base_addr; + cifmap->mem_start = dev->dev_mapping.mem_start; + cifmap->mem_end = dev->dev_mapping.mem_end; + cifmap->base_addr = dev->dev_mapping.base_addr; cifmap->irq = dev->irq; cifmap->dma = dev->dma; cifmap->port = dev->if_port; @@ -98,9 +98,9 @@ static int dev_getifmap(struct net_device *dev, struct ifreq *ifr) return 0; } - ifmap->mem_start = dev->mem_start; - ifmap->mem_end = dev->mem_end; - ifmap->base_addr = dev->base_addr; + ifmap->mem_start = dev->dev_mapping.mem_start; + ifmap->mem_end = dev->dev_mapping.mem_end; + ifmap->base_addr = dev->dev_mapping.base_addr; ifmap->irq = dev->irq; ifmap->dma = dev->dma; ifmap->port = dev->if_port; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5d8eb57867a9..ff8fc1bbda31 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1445,9 +1445,9 @@ static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev) struct rtnl_link_ifmap map; memset(&map, 0, sizeof(map)); - map.mem_start = dev->mem_start; - map.mem_end = dev->mem_end; - map.base_addr = dev->base_addr; + map.mem_start = dev->dev_mapping.mem_start; + map.mem_end = dev->dev_mapping.mem_end; + map.base_addr = dev->dev_mapping.base_addr; map.irq = dev->irq; map.dma = dev->dma; map.port = dev->if_port; -- 2.39.2
WARNING: multiple messages have this Message-ID (diff)
From: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> To: netdev@vger.kernel.org Cc: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>, Linus Torvalds <torvalds@linux-foundation.org>, intel-wired-lan@lists.osuosl.org, davem@davemloft.net, jesse.brandeburg@intel.com Subject: [Intel-wired-lan] [PATCH v1] netdevice: use ifmap isteand of plain fields Date: Fri, 3 Mar 2023 16:08:18 +0100 [thread overview] Message-ID: <20230303150818.132386-1-vincenzopalazzodev@gmail.com> (raw) clean the code by using the ifmap instead of plain fields, and avoid code duplication. P.S: I'm giving credit to the author of the FIXME commit. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> --- drivers/net/ethernet/intel/e1000e/netdev.c | 4 ++-- include/linux/netdevice.h | 8 +------- net/core/dev_ioctl.c | 12 ++++++------ net/core/rtnetlink.c | 6 +++--- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index e1eb1de88bf9..059ff8bcdbbc 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -7476,8 +7476,8 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) netif_napi_add(netdev, &adapter->napi, e1000e_poll); strscpy(netdev->name, pci_name(pdev), sizeof(netdev->name)); - netdev->mem_start = mmio_start; - netdev->mem_end = mmio_start + mmio_len; + netdev->dev_mapping.mem_start = mmio_start; + netdev->dev_mapping.mem_end = mmio_start + mmio_len; adapter->bd_number = cards_found++; diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 6a14b7b11766..c5987e90a078 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -2031,13 +2031,7 @@ struct net_device { char name[IFNAMSIZ]; struct netdev_name_node *name_node; struct dev_ifalias __rcu *ifalias; - /* - * I/O specific fields - * FIXME: Merge these and struct ifmap into one - */ - unsigned long mem_end; - unsigned long mem_start; - unsigned long base_addr; + struct ifmap dev_mapping; /* * Some hardware also needs these fields (state,dev_list, diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 5cdbfbf9a7dc..89469cb97e35 100644 --- a/net/core/dev_ioctl.c +++ b/net/core/dev_ioctl.c @@ -88,9 +88,9 @@ static int dev_getifmap(struct net_device *dev, struct ifreq *ifr) if (in_compat_syscall()) { struct compat_ifmap *cifmap = (struct compat_ifmap *)ifmap; - cifmap->mem_start = dev->mem_start; - cifmap->mem_end = dev->mem_end; - cifmap->base_addr = dev->base_addr; + cifmap->mem_start = dev->dev_mapping.mem_start; + cifmap->mem_end = dev->dev_mapping.mem_end; + cifmap->base_addr = dev->dev_mapping.base_addr; cifmap->irq = dev->irq; cifmap->dma = dev->dma; cifmap->port = dev->if_port; @@ -98,9 +98,9 @@ static int dev_getifmap(struct net_device *dev, struct ifreq *ifr) return 0; } - ifmap->mem_start = dev->mem_start; - ifmap->mem_end = dev->mem_end; - ifmap->base_addr = dev->base_addr; + ifmap->mem_start = dev->dev_mapping.mem_start; + ifmap->mem_end = dev->dev_mapping.mem_end; + ifmap->base_addr = dev->dev_mapping.base_addr; ifmap->irq = dev->irq; ifmap->dma = dev->dma; ifmap->port = dev->if_port; diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 5d8eb57867a9..ff8fc1bbda31 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -1445,9 +1445,9 @@ static int rtnl_fill_link_ifmap(struct sk_buff *skb, struct net_device *dev) struct rtnl_link_ifmap map; memset(&map, 0, sizeof(map)); - map.mem_start = dev->mem_start; - map.mem_end = dev->mem_end; - map.base_addr = dev->base_addr; + map.mem_start = dev->dev_mapping.mem_start; + map.mem_end = dev->dev_mapping.mem_end; + map.base_addr = dev->dev_mapping.base_addr; map.irq = dev->irq; map.dma = dev->dma; map.port = dev->if_port; -- 2.39.2 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next reply other threads:[~2023-03-03 15:09 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-03 15:08 Vincenzo Palazzo [this message] 2023-03-03 15:08 ` [Intel-wired-lan] [PATCH v1] netdevice: use ifmap isteand of plain fields Vincenzo Palazzo 2023-03-03 16:48 ` Paul Menzel 2023-03-03 16:48 ` Paul Menzel 2023-03-03 18:01 ` Vincenzo Palazzo 2023-03-03 18:01 ` Vincenzo Palazzo 2023-03-03 17:15 ` Linus Torvalds 2023-03-03 17:15 ` [Intel-wired-lan] " Linus Torvalds 2023-03-03 19:46 ` kernel test robot 2023-03-03 19:46 ` [Intel-wired-lan] " kernel test robot 2023-03-04 2:04 ` kernel test robot 2023-03-04 2:04 ` [Intel-wired-lan] " kernel test robot 2023-03-04 2:15 ` kernel test robot 2023-03-04 2:15 ` [Intel-wired-lan] " kernel test robot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230303150818.132386-1-vincenzopalazzodev@gmail.com \ --to=vincenzopalazzodev@gmail.com \ --cc=davem@davemloft.net \ --cc=intel-wired-lan@lists.osuosl.org \ --cc=jesse.brandeburg@intel.com \ --cc=netdev@vger.kernel.org \ --cc=torvalds@linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.