Commit 198a5278 authored by Sebastian Ott's avatar Sebastian Ott Committed by Martin Schwidefsky

s390/pci: inline get_zdev

Inline get_zdev to save ~200 bytes of kernel text for CONFIG_PCI=y.
Also rename the function to to_zpci to make clear that we don't do
reference counting here.
Signed-off-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 2acb94f4
...@@ -170,7 +170,11 @@ static inline void zpci_exit_slot(struct zpci_dev *zdev) {} ...@@ -170,7 +170,11 @@ static inline void zpci_exit_slot(struct zpci_dev *zdev) {}
#endif /* CONFIG_HOTPLUG_PCI_S390 */ #endif /* CONFIG_HOTPLUG_PCI_S390 */
/* Helpers */ /* Helpers */
struct zpci_dev *get_zdev(struct pci_dev *); static inline struct zpci_dev *to_zpci(struct pci_dev *pdev)
{
return pdev->sysdata;
}
struct zpci_dev *get_zdev_by_fid(u32); struct zpci_dev *get_zdev_by_fid(u32);
/* DMA */ /* DMA */
......
...@@ -76,11 +76,6 @@ EXPORT_SYMBOL_GPL(zpci_iomap_start); ...@@ -76,11 +76,6 @@ EXPORT_SYMBOL_GPL(zpci_iomap_start);
static struct kmem_cache *zdev_fmb_cache; static struct kmem_cache *zdev_fmb_cache;
struct zpci_dev *get_zdev(struct pci_dev *pdev)
{
return (struct zpci_dev *) pdev->sysdata;
}
struct zpci_dev *get_zdev_by_fid(u32 fid) struct zpci_dev *get_zdev_by_fid(u32 fid)
{ {
struct zpci_dev *tmp, *zdev = NULL; struct zpci_dev *tmp, *zdev = NULL;
...@@ -269,7 +264,7 @@ void __iomem *pci_iomap_range(struct pci_dev *pdev, ...@@ -269,7 +264,7 @@ void __iomem *pci_iomap_range(struct pci_dev *pdev,
unsigned long offset, unsigned long offset,
unsigned long max) unsigned long max)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
u64 addr; u64 addr;
int idx; int idx;
...@@ -385,7 +380,7 @@ static void zpci_irq_handler(struct airq_struct *airq) ...@@ -385,7 +380,7 @@ static void zpci_irq_handler(struct airq_struct *airq)
int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
unsigned int hwirq, msi_vecs; unsigned int hwirq, msi_vecs;
unsigned long aisb; unsigned long aisb;
struct msi_desc *msi; struct msi_desc *msi;
...@@ -460,7 +455,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) ...@@ -460,7 +455,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type)
void arch_teardown_msi_irqs(struct pci_dev *pdev) void arch_teardown_msi_irqs(struct pci_dev *pdev)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
struct msi_desc *msi; struct msi_desc *msi;
int rc; int rc;
...@@ -648,7 +643,7 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev) ...@@ -648,7 +643,7 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev)
int pcibios_add_device(struct pci_dev *pdev) int pcibios_add_device(struct pci_dev *pdev)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
struct resource *res; struct resource *res;
int i; int i;
...@@ -673,7 +668,7 @@ void pcibios_release_device(struct pci_dev *pdev) ...@@ -673,7 +668,7 @@ void pcibios_release_device(struct pci_dev *pdev)
int pcibios_enable_device(struct pci_dev *pdev, int mask) int pcibios_enable_device(struct pci_dev *pdev, int mask)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
zdev->pdev = pdev; zdev->pdev = pdev;
zpci_debug_init_device(zdev); zpci_debug_init_device(zdev);
...@@ -684,7 +679,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask) ...@@ -684,7 +679,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask)
void pcibios_disable_device(struct pci_dev *pdev) void pcibios_disable_device(struct pci_dev *pdev)
{ {
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
zpci_fmb_disable_device(zdev); zpci_fmb_disable_device(zdev);
zpci_debug_exit_device(zdev); zpci_debug_exit_device(zdev);
...@@ -695,7 +690,7 @@ void pcibios_disable_device(struct pci_dev *pdev) ...@@ -695,7 +690,7 @@ void pcibios_disable_device(struct pci_dev *pdev)
static int zpci_restore(struct device *dev) static int zpci_restore(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
int ret = 0; int ret = 0;
if (zdev->state != ZPCI_FN_STATE_ONLINE) if (zdev->state != ZPCI_FN_STATE_ONLINE)
...@@ -717,7 +712,7 @@ static int zpci_restore(struct device *dev) ...@@ -717,7 +712,7 @@ static int zpci_restore(struct device *dev)
static int zpci_freeze(struct device *dev) static int zpci_freeze(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
if (zdev->state != ZPCI_FN_STATE_ONLINE) if (zdev->state != ZPCI_FN_STATE_ONLINE)
return 0; return 0;
......
...@@ -277,7 +277,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page, ...@@ -277,7 +277,7 @@ static dma_addr_t s390_dma_map_pages(struct device *dev, struct page *page,
enum dma_data_direction direction, enum dma_data_direction direction,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
unsigned long nr_pages, iommu_page_index; unsigned long nr_pages, iommu_page_index;
unsigned long pa = page_to_phys(page) + offset; unsigned long pa = page_to_phys(page) + offset;
int flags = ZPCI_PTE_VALID; int flags = ZPCI_PTE_VALID;
...@@ -316,7 +316,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr, ...@@ -316,7 +316,7 @@ static void s390_dma_unmap_pages(struct device *dev, dma_addr_t dma_addr,
size_t size, enum dma_data_direction direction, size_t size, enum dma_data_direction direction,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
unsigned long iommu_page_index; unsigned long iommu_page_index;
int npages; int npages;
...@@ -337,7 +337,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size, ...@@ -337,7 +337,7 @@ static void *s390_dma_alloc(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag, dma_addr_t *dma_handle, gfp_t flag,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
struct page *page; struct page *page;
unsigned long pa; unsigned long pa;
dma_addr_t map; dma_addr_t map;
...@@ -367,7 +367,7 @@ static void s390_dma_free(struct device *dev, size_t size, ...@@ -367,7 +367,7 @@ static void s390_dma_free(struct device *dev, size_t size,
void *pa, dma_addr_t dma_handle, void *pa, dma_addr_t dma_handle,
struct dma_attrs *attrs) struct dma_attrs *attrs)
{ {
struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); struct zpci_dev *zdev = to_zpci(to_pci_dev(dev));
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
atomic64_sub(size / PAGE_SIZE, &zdev->allocated_pages); atomic64_sub(size / PAGE_SIZE, &zdev->allocated_pages);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
static ssize_t name##_show(struct device *dev, \ static ssize_t name##_show(struct device *dev, \
struct device_attribute *attr, char *buf) \ struct device_attribute *attr, char *buf) \
{ \ { \
struct zpci_dev *zdev = get_zdev(to_pci_dev(dev)); \ struct zpci_dev *zdev = to_zpci(to_pci_dev(dev)); \
\ \
return sprintf(buf, fmt, zdev->member); \ return sprintf(buf, fmt, zdev->member); \
} \ } \
...@@ -38,7 +38,7 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr, ...@@ -38,7 +38,7 @@ static ssize_t recover_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
int ret; int ret;
if (!device_remove_file_self(dev, attr)) if (!device_remove_file_self(dev, attr))
...@@ -64,7 +64,7 @@ static ssize_t util_string_read(struct file *filp, struct kobject *kobj, ...@@ -64,7 +64,7 @@ static ssize_t util_string_read(struct file *filp, struct kobject *kobj,
{ {
struct device *dev = kobj_to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
struct zpci_dev *zdev = get_zdev(pdev); struct zpci_dev *zdev = to_zpci(pdev);
return memory_read_from_buffer(buf, count, &off, zdev->util_str, return memory_read_from_buffer(buf, count, &off, zdev->util_str,
sizeof(zdev->util_str)); sizeof(zdev->util_str));
......
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