oxnas: remove support for pre-4.4 kernels from drivers

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
Daniel Golle 2017-01-04 19:40:32 +01:00
parent ed69e93262
commit a46c9a4038
4 changed files with 1 additions and 63 deletions

View file

@ -8,7 +8,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/version.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
@ -74,11 +73,7 @@ static void __init ox820_dt_init(void)
static void __init ox820_timer_init(void) static void __init ox820_timer_init(void)
{ {
of_clk_init(NULL); of_clk_init(NULL);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
clocksource_of_init();
#else
clocksource_probe(); clocksource_probe();
#endif
} }
void ox820_init_early(void) void ox820_init_early(void)

View file

@ -6,13 +6,7 @@
#include <linux/irqchip/chained_irq.h> #include <linux/irqchip/chained_irq.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/version.h> #include <linux/irqchip.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
# include "irqchip.h"
#else
# include <linux/irqchip.h>
#endif
struct rps_chip_data { struct rps_chip_data {
void __iomem *base; void __iomem *base;
@ -62,11 +56,7 @@ static int rps_irq_domain_xlate(struct irq_domain *d,
unsigned long *out_hwirq, unsigned long *out_hwirq,
unsigned int *out_type) unsigned int *out_type)
{ {
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
if (d->of_node != controller)
#else
if (irq_domain_get_of_node(d) != controller) if (irq_domain_get_of_node(d) != controller)
#endif
return -EINVAL; return -EINVAL;
if (intsize < 1) if (intsize < 1)
return -EINVAL; return -EINVAL;
@ -82,11 +72,7 @@ static int rps_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw) irq_hw_number_t hw)
{ {
irq_set_chip_and_handler(irq, &rps_chip, handle_level_irq); irq_set_chip_and_handler(irq, &rps_chip, handle_level_irq);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
#else
irq_set_probe(irq); irq_set_probe(irq);
#endif
irq_set_chip_data(irq, d->host_data); irq_set_chip_data(irq, d->host_data);
return 0; return 0;
} }
@ -96,11 +82,7 @@ const struct irq_domain_ops rps_irq_domain_ops = {
.xlate = rps_irq_domain_xlate, .xlate = rps_irq_domain_xlate,
}; };
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
static void rps_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
#else
static void rps_handle_cascade_irq(struct irq_desc *desc) static void rps_handle_cascade_irq(struct irq_desc *desc)
#endif
{ {
struct rps_chip_data *chip_data = irq_desc_get_handler_data(desc); struct rps_chip_data *chip_data = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
@ -114,11 +96,7 @@ static void rps_handle_cascade_irq(struct irq_desc *desc)
cascade_irq = irq_find_mapping(chip_data->domain, rps_irq); cascade_irq = irq_find_mapping(chip_data->domain, rps_irq);
if (unlikely(rps_irq >= RPS_IRQ_COUNT)) if (unlikely(rps_irq >= RPS_IRQ_COUNT))
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
handle_bad_irq(cascade_irq, desc);
#else
handle_bad_irq(desc); handle_bad_irq(desc);
#endif
else else
generic_handle_irq(cascade_irq); generic_handle_irq(cascade_irq);

View file

@ -25,7 +25,6 @@
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/reset.h> #include <linux/reset.h>
#include <linux/stmmac.h> #include <linux/stmmac.h>
#include <linux/version.h>
#include <mach/hardware.h> #include <mach/hardware.h>
@ -92,37 +91,21 @@ static void oxnas_gmac_exit(struct platform_device *pdev, void *priv)
} }
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
static void *oxnas_gmac_probe(struct platform_device *pdev)
{
#else
static int oxnas_gmac_probe(struct platform_device *pdev) static int oxnas_gmac_probe(struct platform_device *pdev)
{ {
struct plat_stmmacenet_data *plat_dat; struct plat_stmmacenet_data *plat_dat;
struct stmmac_resources stmmac_res; struct stmmac_resources stmmac_res;
int ret; int ret;
#endif
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct oxnas_gmac *bsp_priv; struct oxnas_gmac *bsp_priv;
bsp_priv = devm_kzalloc(dev, sizeof(*bsp_priv), GFP_KERNEL); bsp_priv = devm_kzalloc(dev, sizeof(*bsp_priv), GFP_KERNEL);
if (!bsp_priv) if (!bsp_priv)
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
return ERR_PTR(-ENOMEM);
#else
return -ENOMEM; return -ENOMEM;
#endif
bsp_priv->clk = devm_clk_get(dev, "gmac"); bsp_priv->clk = devm_clk_get(dev, "gmac");
if (IS_ERR(bsp_priv->clk)) if (IS_ERR(bsp_priv->clk))
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
return bsp_priv->clk;
#else
return PTR_ERR(bsp_priv->clk); return PTR_ERR(bsp_priv->clk);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
return bsp_priv;
#else
ret = stmmac_get_platform_resources(pdev, &stmmac_res); ret = stmmac_get_platform_resources(pdev, &stmmac_res);
if (ret) if (ret)
return ret; return ret;
@ -140,17 +123,8 @@ static int oxnas_gmac_probe(struct platform_device *pdev)
return ret; return ret;
return stmmac_dvr_probe(dev, plat_dat, &stmmac_res); return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
#endif
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
const struct stmmac_of_data oxnas_gmac_data = {
.has_gmac = 1,
.setup = oxnas_gmac_probe,
.init = oxnas_gmac_init,
.exit = oxnas_gmac_exit,
};
#else
static const struct of_device_id oxnas_gmac_match[] = { static const struct of_device_id oxnas_gmac_match[] = {
{ .compatible = "plxtech,nas782x-gmac" }, { .compatible = "plxtech,nas782x-gmac" },
{ } { }
@ -167,6 +141,5 @@ static struct platform_driver oxnas_gmac_driver = {
}, },
}; };
module_platform_driver(oxnas_gmac_driver); module_platform_driver(oxnas_gmac_driver);
#endif
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View file

@ -27,7 +27,6 @@
/* Since we request GPIOs from ourself */ /* Since we request GPIOs from ourself */
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/version.h>
#include "core.h" #include "core.h"
@ -1200,11 +1199,7 @@ static struct irq_chip gpio_irqchip = {
.irq_set_type = gpio_irq_type, .irq_set_type = gpio_irq_type,
}; };
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
#else
static void gpio_irq_handler(struct irq_desc *desc) static void gpio_irq_handler(struct irq_desc *desc)
#endif
{ {
struct irq_chip *chip = irq_desc_get_chip(desc); struct irq_chip *chip = irq_desc_get_chip(desc);
struct irq_data *idata = irq_desc_get_irq_data(desc); struct irq_data *idata = irq_desc_get_irq_data(desc);
@ -1245,9 +1240,6 @@ static int oxnas_gpio_irq_map(struct irq_domain *h, unsigned int virq,
irq_set_lockdep_class(virq, &gpio_lock_class); irq_set_lockdep_class(virq, &gpio_lock_class);
irq_set_chip_and_handler(virq, &gpio_irqchip, handle_edge_irq); irq_set_chip_and_handler(virq, &gpio_irqchip, handle_edge_irq);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
set_irq_flags(virq, IRQF_VALID);
#endif
irq_set_chip_data(virq, oxnas_gpio); irq_set_chip_data(virq, oxnas_gpio);
return 0; return 0;