diff options
200 files changed, 1819 insertions, 1174 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt new file mode 100644 index 00000000000..80a37193c0b --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/twl4030-wdt.txt @@ -0,0 +1,10 @@ +Device tree bindings for twl4030-wdt driver (TWL4030 watchdog) + +Required properties: +	compatible = "ti,twl4030-wdt"; + +Example: + +watchdog { +	compatible = "ti,twl4030-wdt"; +}; diff --git a/MAINTAINERS b/MAINTAINERS index 4e2a1f67a1f..fa309ab7ccb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5385,6 +5385,15 @@ F:	arch/arm/*omap*/  F:	drivers/i2c/busses/i2c-omap.c  F:	include/linux/i2c-omap.h +OMAP DEVICE TREE SUPPORT +M:	Benoît Cousson <b-cousson@ti.com> +M:	Tony Lindgren <tony@atomide.com> +L:	linux-omap@vger.kernel.org +L:	devicetree-discuss@lists.ozlabs.org (moderated for non-subscribers) +S:	Maintained +F:	arch/arm/boot/dts/*omap* +F:	arch/arm/boot/dts/*am3* +  OMAP CLOCK FRAMEWORK SUPPORT  M:	Paul Walmsley <paul@pwsan.com>  L:	linux-omap@vger.kernel.org @@ -1,7 +1,7 @@  VERSION = 3  PATCHLEVEL = 8  SUBLEVEL = 0 -EXTRAVERSION = -rc1 +EXTRAVERSION = -rc2  NAME = Terrified Chipmunk  # *DOCUMENTATION* diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi index 63411b03693..ed0bc954683 100644 --- a/arch/arm/boot/dts/twl4030.dtsi +++ b/arch/arm/boot/dts/twl4030.dtsi @@ -19,6 +19,10 @@  		interrupts = <11>;  	}; +	watchdog { +		compatible = "ti,twl4030-wdt"; +	}; +  	vdac: regulator-vdac {  		compatible = "ti,twl4030-vdac";  		regulator-min-microvolt = <1800000>; diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index dbea6f4efe9..2eeff1e64b6 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -6,6 +6,7 @@ CONFIG_MACH_ARMADA_370=y  CONFIG_MACH_ARMADA_XP=y  CONFIG_ARCH_HIGHBANK=y  CONFIG_ARCH_SOCFPGA=y +CONFIG_ARCH_SUNXI=y  # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set  CONFIG_ARM_ERRATA_754322=y  CONFIG_SMP=y diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index a1dc5c071e7..82ce8d738fa 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -65,6 +65,8 @@ CONFIG_MAC80211_RC_PID=y  CONFIG_MAC80211_RC_DEFAULT_PID=y  CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"  CONFIG_CONNECTOR=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y  CONFIG_MTD=y  CONFIG_MTD_CMDLINE_PARTS=y  CONFIG_MTD_CHAR=y @@ -132,9 +134,11 @@ CONFIG_POWER_SUPPLY=y  CONFIG_WATCHDOG=y  CONFIG_OMAP_WATCHDOG=y  CONFIG_TWL4030_WATCHDOG=y +CONFIG_MFD_TPS65217=y  CONFIG_REGULATOR_TWL4030=y  CONFIG_REGULATOR_TPS65023=y  CONFIG_REGULATOR_TPS6507X=y +CONFIG_REGULATOR_TPS65217=y  CONFIG_FB=y  CONFIG_FIRMWARE_EDID=y  CONFIG_FB_MODE_HELPERS=y @@ -170,6 +174,7 @@ CONFIG_SND_DEBUG=y  CONFIG_SND_USB_AUDIO=m  CONFIG_SND_SOC=m  CONFIG_SND_OMAP_SOC=m +CONFIG_SND_OMAP_SOC_OMAP_TWL4030=m  CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m  CONFIG_USB=y  CONFIG_USB_DEBUG=y diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile index f0e69cbc5ba..222d58c0ae7 100644 --- a/arch/arm/mach-omap1/Makefile +++ b/arch/arm/mach-omap1/Makefile @@ -4,7 +4,7 @@  # Common support  obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \ -	 serial.o devices.o dma.o +	 serial.o devices.o dma.o fb.o  obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o  ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) diff --git a/arch/arm/mach-omap1/fb.c b/arch/arm/mach-omap1/fb.c new file mode 100644 index 00000000000..c770d45c722 --- /dev/null +++ b/arch/arm/mach-omap1/fb.c @@ -0,0 +1,80 @@ +/* + * File: arch/arm/plat-omap/fb.c + * + * Framebuffer device registration for TI OMAP platforms + * + * Copyright (C) 2006 Nokia Corporation + * Author: Imre Deak <imre.deak@nokia.com> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. + */ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/memblock.h> +#include <linux/io.h> +#include <linux/omapfb.h> +#include <linux/dma-mapping.h> + +#include <asm/mach/map.h> + +#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) + +static bool omapfb_lcd_configured; +static struct omapfb_platform_data omapfb_config; + +static u64 omap_fb_dma_mask = ~(u32)0; + +static struct platform_device omap_fb_device = { +	.name		= "omapfb", +	.id		= -1, +	.dev = { +		.dma_mask		= &omap_fb_dma_mask, +		.coherent_dma_mask	= DMA_BIT_MASK(32), +		.platform_data		= &omapfb_config, +	}, +	.num_resources = 0, +}; + +void __init omapfb_set_lcd_config(const struct omap_lcd_config *config) +{ +	omapfb_config.lcd = *config; +	omapfb_lcd_configured = true; +} + +static int __init omap_init_fb(void) +{ +	/* +	 * If the board file has not set the lcd config with +	 * omapfb_set_lcd_config(), don't bother registering the omapfb device +	 */ +	if (!omapfb_lcd_configured) +		return 0; + +	return platform_device_register(&omap_fb_device); +} + +arch_initcall(omap_init_fb); + +#else + +void __init omapfb_set_lcd_config(const struct omap_lcd_config *config) +{ +} + +#endif diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index a8004f33b7e..947cafe65ae 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -3,7 +3,7 @@  #  # Common support -obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ +obj-y := id.o io.o control.o mux.o devices.o fb.o serial.o gpmc.o timer.o pm.o \  	 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \  	 omap_device.o sram.o diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h index 3d944d3263d..e6c328128a0 100644 --- a/arch/arm/mach-omap2/control.h +++ b/arch/arm/mach-omap2/control.h @@ -234,7 +234,7 @@  #define OMAP343X_PADCONF_ETK_D14	OMAP343X_PADCONF_ETK(16)  #define OMAP343X_PADCONF_ETK_D15	OMAP343X_PADCONF_ETK(17) -/* 34xx GENERAL_WKUP regist offsets */ +/* 34xx GENERAL_WKUP register offsets */  #define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \  						0x008 + (i))  #define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c index 2bb18838cba..0a02aab5df6 100644 --- a/arch/arm/mach-omap2/dpll3xxx.c +++ b/arch/arm/mach-omap2/dpll3xxx.c @@ -504,8 +504,7 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,  		if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {  			freqsel = _omap3_dpll_compute_freqsel(clk,  						dd->last_rounded_n); -			if (!freqsel) -				WARN_ON(1); +			WARN_ON(!freqsel);  		}  		pr_debug("%s: %s: set rate: locking rate to %lu.\n", diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c index fce5aa3fff4..4c7566c7e24 100644 --- a/arch/arm/mach-omap2/drm.c +++ b/arch/arm/mach-omap2/drm.c @@ -27,7 +27,6 @@  #include "omap_device.h"  #include "omap_hwmod.h" -#include <plat/cpu.h>  #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) diff --git a/arch/arm/mach-omap2/dss-common.c b/arch/arm/mach-omap2/dss-common.c index 679a0478644..4be5cfc81ab 100644 --- a/arch/arm/mach-omap2/dss-common.c +++ b/arch/arm/mach-omap2/dss-common.c @@ -31,8 +31,7 @@  #include <video/omap-panel-nokia-dsi.h>  #include <video/omap-panel-picodlp.h> -#include <plat/cpu.h> - +#include "soc.h"  #include "dss-common.h"  #include "mux.h" diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/mach-omap2/fb.c index a3367b783fc..d9bd965f6d0 100644 --- a/arch/arm/plat-omap/fb.c +++ b/arch/arm/mach-omap2/fb.c @@ -1,6 +1,4 @@  /* - * File: arch/arm/plat-omap/fb.c - *   * Framebuffer device registration for TI OMAP platforms   *   * Copyright (C) 2006 Nokia Corporation @@ -33,7 +31,7 @@  #include <asm/mach/map.h> -#include <plat/cpu.h> +#include "soc.h"  #ifdef CONFIG_OMAP2_VRFB @@ -94,45 +92,7 @@ static int __init omap_init_vrfb(void)  arch_initcall(omap_init_vrfb);  #endif -#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) - -static bool omapfb_lcd_configured; -static struct omapfb_platform_data omapfb_config; - -static u64 omap_fb_dma_mask = ~(u32)0; - -static struct platform_device omap_fb_device = { -	.name		= "omapfb", -	.id		= -1, -	.dev = { -		.dma_mask		= &omap_fb_dma_mask, -		.coherent_dma_mask	= DMA_BIT_MASK(32), -		.platform_data		= &omapfb_config, -	}, -	.num_resources = 0, -}; - -void __init omapfb_set_lcd_config(const struct omap_lcd_config *config) -{ -	omapfb_config.lcd = *config; -	omapfb_lcd_configured = true; -} - -static int __init omap_init_fb(void) -{ -	/* -	 * If the board file has not set the lcd config with -	 * omapfb_set_lcd_config(), don't bother registering the omapfb device -	 */ -	if (!omapfb_lcd_configured) -		return 0; - -	return platform_device_register(&omap_fb_device); -} - -arch_initcall(omap_init_fb); - -#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)  static u64 omap_fb_dma_mask = ~(u32)0;  static struct omapfb_platform_data omapfb_config; @@ -155,10 +115,4 @@ static int __init omap_init_fb(void)  arch_initcall(omap_init_fb); -#else - -void __init omapfb_set_lcd_config(const struct omap_lcd_config *config) -{ -} -  #endif diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index f9fab942d5b..129d5081ed1 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c @@ -26,7 +26,6 @@  #include <linux/omap-dma.h> -#include <linux/platform_data/omap_ocp2scp.h>  #include <linux/platform_data/spi-omap2-mcspi.h>  #include <linux/platform_data/asoc-ti-mcbsp.h>  #include <linux/platform_data/iommu-omap.h> diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c index fefd4016662..615e5b1fb02 100644 --- a/arch/arm/mach-omap2/omap_twl.c +++ b/arch/arm/mach-omap2/omap_twl.c @@ -292,8 +292,8 @@ int __init omap3_twl_set_sr_bit(bool enable)  	if (twl_sr_enable_autoinit)  		pr_warning("%s: unexpected multiple calls\n", __func__); -	ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &temp, -					TWL4030_DCDC_GLOBAL_CFG); +	ret = twl_i2c_read_u8(TWL_MODULE_PM_RECEIVER, &temp, +			      TWL4030_DCDC_GLOBAL_CFG);  	if (ret)  		goto err; @@ -302,8 +302,8 @@ int __init omap3_twl_set_sr_bit(bool enable)  	else  		temp &= ~SMARTREFLEX_ENABLE; -	ret = twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, temp, -				TWL4030_DCDC_GLOBAL_CFG); +	ret = twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, temp, +			       TWL4030_DCDC_GLOBAL_CFG);  	if (!ret) {  		twl_sr_enable_autoinit = true;  		return 0; diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c index 250d909e38b..eb78ae7a346 100644 --- a/arch/arm/mach-omap2/pmu.c +++ b/arch/arm/mach-omap2/pmu.c @@ -11,8 +11,6 @@   * the Free Software Foundation; either version 2 of the License, or   * (at your option) any later version.   */ -#include <linux/pm_runtime.h> -  #include <asm/pmu.h>  #include "soc.h" diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c index faeab18696d..cc0e71430af 100644 --- a/arch/arm/mach-omap2/prm2xxx.c +++ b/arch/arm/mach-omap2/prm2xxx.c @@ -18,9 +18,8 @@  #include <linux/io.h>  #include <linux/irq.h> +#include "soc.h"  #include "common.h" -#include <plat/cpu.h> -  #include "vp.h"  #include "powerdomain.h"  #include "clockdomain.h" diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index db198d05858..39822aabcff 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -18,9 +18,8 @@  #include <linux/io.h>  #include <linux/irq.h> +#include "soc.h"  #include "common.h" -#include <plat/cpu.h> -  #include "vp.h"  #include "powerdomain.h"  #include "prm3xxx.h" diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c index cba4cd3bf93..6980cfa646f 100644 --- a/arch/arm/mach-sunxi/sunxi.c +++ b/arch/arm/mach-sunxi/sunxi.c @@ -80,8 +80,8 @@ static void __init sunxi_dt_init(void)  }  static const char * const sunxi_board_dt_compat[] = { -	"allwinner,sun4i", -	"allwinner,sun5i", +	"allwinner,sun4i-a10", +	"allwinner,sun5i-a13",  	NULL,  }; diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile index 9d9aa2f5512..a14a78a2f14 100644 --- a/arch/arm/plat-omap/Makefile +++ b/arch/arm/plat-omap/Makefile @@ -3,7 +3,7 @@  #  # Common support -obj-y := sram.o dma.o fb.o counter_32k.o +obj-y := sram.o dma.o counter_32k.o  obj-m :=  obj-n :=  obj-  := diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 89585c29355..d51b75bdcad 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c @@ -898,19 +898,8 @@ static struct platform_driver omap_dm_timer_driver = {  	},  }; -static int __init omap_dm_timer_driver_init(void) -{ -	return platform_driver_register(&omap_dm_timer_driver); -} - -static void __exit omap_dm_timer_driver_exit(void) -{ -	platform_driver_unregister(&omap_dm_timer_driver); -} -  early_platform_init("earlytimer", &omap_dm_timer_driver); -module_init(omap_dm_timer_driver_init); -module_exit(omap_dm_timer_driver_exit); +module_platform_driver(omap_dm_timer_driver);  MODULE_DESCRIPTION("OMAP Dual-Mode Timer Driver");  MODULE_LICENSE("GPL"); diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h index b4516aba67e..c9a66bf36c9 100644 --- a/arch/arm/plat-omap/include/plat/cpu.h +++ b/arch/arm/plat-omap/include/plat/cpu.h @@ -32,8 +32,4 @@  #include <mach/soc.h>  #endif -#ifdef CONFIG_ARCH_OMAP2PLUS -#include "../../mach-omap2/soc.h" -#endif -  #endif diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 1b1dda90a94..412e1286d1f 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -434,7 +434,8 @@ static const struct dmi_system_id __devinitconst pciprobe_dmi_table[] = {  		.callback = set_scan_all,  		.ident = "Stratus/NEC ftServer",  		.matches = { -			DMI_MATCH(DMI_SYS_VENDOR, "ftServer"), +			DMI_MATCH(DMI_SYS_VENDOR, "Stratus"), +			DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),  		},  	},  	{} diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c index d70abe77f73..d47db401027 100644 --- a/drivers/atm/solos-pci.c +++ b/drivers/atm/solos-pci.c @@ -538,7 +538,7 @@ static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr  	} else {  		count = -EINVAL;  	} -	spin_lock_irq(&card->param_queue_lock); +	spin_unlock_irq(&card->param_queue_lock);  	return count;  } diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c index 0761a03cdbb..2bf9670ba29 100644 --- a/drivers/gpu/drm/drm_mm.c +++ b/drivers/gpu/drm/drm_mm.c @@ -184,19 +184,27 @@ EXPORT_SYMBOL(drm_mm_get_block_generic);   * -ENOSPC if no suitable free area is available. The preallocated memory node   * must be cleared.   */ -int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, -		       unsigned long size, unsigned alignment) +int drm_mm_insert_node_generic(struct drm_mm *mm, struct drm_mm_node *node, +			       unsigned long size, unsigned alignment, +			       unsigned long color)  {  	struct drm_mm_node *hole_node; -	hole_node = drm_mm_search_free(mm, size, alignment, false); +	hole_node = drm_mm_search_free_generic(mm, size, alignment, +					       color, 0);  	if (!hole_node)  		return -ENOSPC; -	drm_mm_insert_helper(hole_node, node, size, alignment, 0); - +	drm_mm_insert_helper(hole_node, node, size, alignment, color);  	return 0;  } +EXPORT_SYMBOL(drm_mm_insert_node_generic); + +int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, +		       unsigned long size, unsigned alignment) +{ +	return drm_mm_insert_node_generic(mm, node, size, alignment, 0); +}  EXPORT_SYMBOL(drm_mm_insert_node);  static void drm_mm_insert_helper_range(struct drm_mm_node *hole_node, @@ -275,22 +283,31 @@ EXPORT_SYMBOL(drm_mm_get_block_range_generic);   * -ENOSPC if no suitable free area is available. This is for range   * restricted allocations. The preallocated memory node must be cleared.   */ -int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, -				unsigned long size, unsigned alignment, -				unsigned long start, unsigned long end) +int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, struct drm_mm_node *node, +					unsigned long size, unsigned alignment, unsigned long color, +					unsigned long start, unsigned long end)  {  	struct drm_mm_node *hole_node; -	hole_node = drm_mm_search_free_in_range(mm, size, alignment, -						start, end, false); +	hole_node = drm_mm_search_free_in_range_generic(mm, +							size, alignment, color, +							start, end, 0);  	if (!hole_node)  		return -ENOSPC; -	drm_mm_insert_helper_range(hole_node, node, size, alignment, 0, +	drm_mm_insert_helper_range(hole_node, node, +				   size, alignment, color,  				   start, end); -  	return 0;  } +EXPORT_SYMBOL(drm_mm_insert_node_in_range_generic); + +int drm_mm_insert_node_in_range(struct drm_mm *mm, struct drm_mm_node *node, +				unsigned long size, unsigned alignment, +				unsigned long start, unsigned long end) +{ +	return drm_mm_insert_node_in_range_generic(mm, node, size, alignment, 0, start, end); +}  EXPORT_SYMBOL(drm_mm_insert_node_in_range);  /** diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 8f63cd5de4b..99daa896105 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c @@ -989,6 +989,9 @@ static int i915_getparam(struct drm_device *dev, void *data,  	case I915_PARAM_HAS_SECURE_BATCHES:  		value = capable(CAP_SYS_ADMIN);  		break; +	case I915_PARAM_HAS_PINNED_BATCHES: +		value = 1; +		break;  	default:  		DRM_DEBUG_DRIVER("Unknown parameter %d\n",  				 param->param); diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 557843dd4b2..ed305957557 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -780,6 +780,7 @@ typedef struct drm_i915_private {  		struct i915_hw_ppgtt *aliasing_ppgtt;  		struct shrinker inactive_shrinker; +		bool shrinker_no_lock_stealing;  		/**  		 * List of objects currently involved in rendering. @@ -1100,6 +1101,7 @@ struct drm_i915_gem_object {  	 */  	atomic_t pending_flip;  }; +#define to_gem_object(obj) (&((struct drm_i915_gem_object *)(obj))->base)  #define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base) @@ -1166,6 +1168,9 @@ struct drm_i915_file_private {  #define IS_IVB_GT1(dev)		((dev)->pci_device == 0x0156 || \  				 (dev)->pci_device == 0x0152 ||	\  				 (dev)->pci_device == 0x015a) +#define IS_SNB_GT1(dev)		((dev)->pci_device == 0x0102 || \ +				 (dev)->pci_device == 0x0106 ||	\ +				 (dev)->pci_device == 0x010A)  #define IS_VALLEYVIEW(dev)	(INTEL_INFO(dev)->is_valleyview)  #define IS_HASWELL(dev)	(INTEL_INFO(dev)->is_haswell)  #define IS_MOBILE(dev)		(INTEL_INFO(dev)->is_mobile) @@ -1196,6 +1201,9 @@ struct drm_i915_file_private {  #define HAS_OVERLAY(dev)		(INTEL_INFO(dev)->has_overlay)  #define OVERLAY_NEEDS_PHYSICAL(dev)	(INTEL_INFO(dev)->overlay_needs_physical) +/* Early gen2 have a totally busted CS tlb and require pinned batches. */ +#define HAS_BROKEN_CS_TLB(dev)		(IS_I830(dev) || IS_845G(dev)) +  /* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte   * rows, which changed the alignment requirements and fence programming.   */ diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 742206e4510..da3c82e301b 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1517,9 +1517,11 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)  	if (obj->base.map_list.map)  		return 0; +	dev_priv->mm.shrinker_no_lock_stealing = true; +  	ret = drm_gem_create_mmap_offset(&obj->base);  	if (ret != -ENOSPC) -		return ret; +		goto out;  	/* Badly fragmented mmap space? The only way we can recover  	 * space is by destroying unwanted objects. We can't randomly release @@ -1531,10 +1533,14 @@ static int i915_gem_object_create_mmap_offset(struct drm_i915_gem_object *obj)  	i915_gem_purge(dev_priv, obj->base.size >> PAGE_SHIFT);  	ret = drm_gem_create_mmap_offset(&obj->base);  	if (ret != -ENOSPC) -		return ret; +		goto out;  	i915_gem_shrink_all(dev_priv); -	return drm_gem_create_mmap_offset(&obj->base); +	ret = drm_gem_create_mmap_offset(&obj->base); +out: +	dev_priv->mm.shrinker_no_lock_stealing = false; + +	return ret;  }  static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj) @@ -2890,7 +2896,7 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,  {  	struct drm_device *dev = obj->base.dev;  	drm_i915_private_t *dev_priv = dev->dev_private; -	struct drm_mm_node *free_space; +	struct drm_mm_node *node;  	u32 size, fence_size, fence_alignment, unfenced_alignment;  	bool mappable, fenceable;  	int ret; @@ -2936,66 +2942,54 @@ i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj,  	i915_gem_object_pin_pages(obj); +	node = kzalloc(sizeof(*node), GFP_KERNEL); +	if (node == NULL) { +		i915_gem_object_unpin_pages(obj); +		return -ENOMEM; +	} +   search_free:  	if (map_and_fenceable) -		free_space = drm_mm_search_free_in_range_color(&dev_priv->mm.gtt_space, -							       size, alignment, obj->cache_level, -							       0, dev_priv->mm.gtt_mappable_end, -							       false); +		ret = drm_mm_insert_node_in_range_generic(&dev_priv->mm.gtt_space, node, +							  size, alignment, obj->cache_level, +							  0, dev_priv->mm.gtt_mappable_end);  	else -		free_space = drm_mm_search_free_color(&dev_priv->mm.gtt_space, -						      size, alignment, obj->cache_level, -						      false); - -	if (free_space != NULL) { -		if (map_and_fenceable) -			free_space = -				drm_mm_get_block_range_generic(free_space, -							       size, alignment, obj->cache_level, -							       0, dev_priv->mm.gtt_mappable_end, -							       false); -		else -			free_space = -				drm_mm_get_block_generic(free_space, -							 size, alignment, obj->cache_level, -							 false); -	} -	if (free_space == NULL) { +		ret = drm_mm_insert_node_generic(&dev_priv->mm.gtt_space, node, +						 size, alignment, obj->cache_level); +	if (ret) {  		ret = i915_gem_evict_something(dev, size, alignment,  					       obj->cache_level,  					       map_and_fenceable,  					       nonblocking); -		if (ret) { -			i915_gem_object_unpin_pages(obj); -			return ret; -		} +		if (ret == 0) +			goto search_free; -		goto search_free; +		i915_gem_object_unpin_pages(obj); +		kfree(node); +		return ret;  	} -	if (WARN_ON(!i915_gem_valid_gtt_space(dev, -					      free_space, -					      obj->cache_level))) { +	if (WARN_ON(!i915_gem_valid_gtt_space(dev, node, obj->cache_level))) {  		i915_gem_object_unpin_pages(obj); -		drm_mm_put_block(free_space); +		drm_mm_put_block(node);  		return -EINVAL;  	}  	ret = i915_gem_gtt_prepare_object(obj);  	if (ret) {  		i915_gem_object_unpin_pages(obj); -		drm_mm_put_block(free_space); +		drm_mm_put_block(node);  		return ret;  	}  	list_move_tail(&obj->gtt_list, &dev_priv->mm.bound_list);  	list_add_tail(&obj->mm_list, &dev_priv->mm.inactive_list); -	obj->gtt_space = free_space; -	obj->gtt_offset = free_space->start; +	obj->gtt_space = node; +	obj->gtt_offset = node->start;  	fenceable = -		free_space->size == fence_size && -		(free_space->start & (fence_alignment - 1)) == 0; +		node->size == fence_size && +		(node->start & (fence_alignment - 1)) == 0;  	mappable =  		obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end; @@ -4392,6 +4386,9 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)  		if (!mutex_is_locked_by(&dev->struct_mutex, current))  			return 0; +		if (dev_priv->mm.shrinker_no_lock_stealing) +			return 0; +  		unlock = false;  	} diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c index 773ef77b6c2..7be4241e824 100644 --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c @@ -226,7 +226,7 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev,  {  	struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); -	return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, 0600); +	return dma_buf_export(obj, &i915_dmabuf_ops, obj->base.size, flags);  }  static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index ee8f97f0539..d6a994a0739 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -808,6 +808,8 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,  		flags |= I915_DISPATCH_SECURE;  	} +	if (args->flags & I915_EXEC_IS_PINNED) +		flags |= I915_DISPATCH_PINNED;  	switch (args->flags & I915_EXEC_RING_MASK) {  	case I915_EXEC_DEFAULT: diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index a4dc97f8b9f..2220dec3e5d 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c @@ -1087,6 +1087,18 @@ i915_error_first_batchbuffer(struct drm_i915_private *dev_priv,  	if (!ring->get_seqno)  		return NULL; +	if (HAS_BROKEN_CS_TLB(dev_priv->dev)) { +		u32 acthd = I915_READ(ACTHD); + +		if (WARN_ON(ring->id != RCS)) +			return NULL; + +		obj = ring->private; +		if (acthd >= obj->gtt_offset && +		    acthd < obj->gtt_offset + obj->base.size) +			return i915_error_object_create(dev_priv, obj); +	} +  	seqno = ring->get_seqno(ring, false);  	list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {  		if (obj->ring != ring) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3f75cfaf1c3..186ee5c85b5 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -517,6 +517,7 @@   * the enables for writing to the corresponding low bit.   */  #define _3D_CHICKEN	0x02084 +#define  _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB	(1 << 10)  #define _3D_CHICKEN2	0x0208c  /* Disables pipelining of read flushes past the SF-WIZ interface.   * Required on all Ironlake steppings according to the B-Spec, but the @@ -532,7 +533,8 @@  # define MI_FLUSH_ENABLE				(1 << 12)  #define GEN6_GT_MODE	0x20d0 -#define   GEN6_GT_MODE_HI	(1 << 9) +#define   GEN6_GT_MODE_HI				(1 << 9) +#define   GEN6_TD_FOUR_ROW_DISPATCH_DISABLE		(1 << 5)  #define GFX_MODE	0x02520  #define GFX_MODE_GEN7	0x0229c diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5d127e06895..a9fb046b94a 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -8144,10 +8144,6 @@ intel_modeset_stage_output_state(struct drm_device *dev,  			DRM_DEBUG_KMS("encoder changed, full mode switch\n");  			config->mode_changed = true;  		} - -		/* Disable all disconnected encoders. */ -		if (connector->base.status == connector_status_disconnected) -			connector->new_encoder = NULL;  	}  	/* connector->new_encoder is now updated for all connectors. */ @@ -9167,6 +9163,23 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)  	 * the crtc fixup. */  } +static void i915_redisable_vga(struct drm_device *dev) +{ +	struct drm_i915_private *dev_priv = dev->dev_private; +	u32 vga_reg; + +	if (HAS_PCH_SPLIT(dev)) +		vga_reg = CPU_VGACNTRL; +	else +		vga_reg = VGACNTRL; + +	if (I915_READ(vga_reg) != VGA_DISP_DISABLE) { +		DRM_DEBUG_KMS("Something enabled VGA plane, disabling it\n"); +		I915_WRITE(vga_reg, VGA_DISP_DISABLE); +		POSTING_READ(vga_reg); +	} +} +  /* Scan out the current hw modeset state, sanitizes it and maps it into the drm   * and i915 state tracking structures. */  void intel_modeset_setup_hw_state(struct drm_device *dev, @@ -9275,6 +9288,8 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,  			intel_set_mode(&crtc->base, &crtc->base.mode,  				       crtc->base.x, crtc->base.y, crtc->base.fb);  		} + +		i915_redisable_vga(dev);  	} else {  		intel_modeset_update_staged_output_state(dev);  	} diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 496caa73eb7..e6f54ffab3b 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -405,7 +405,7 @@ void intel_update_fbc(struct drm_device *dev)  	 *   - going to an unsupported config (interlace, pixel multiply, etc.)  	 */  	list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { -		if (tmp_crtc->enabled && +		if (to_intel_crtc(tmp_crtc)->active &&  		    !to_intel_crtc(tmp_crtc)->primary_disabled &&  		    tmp_crtc->fb) {  			if (crtc) { @@ -992,7 +992,7 @@ static struct drm_crtc *single_enabled_crtc(struct drm_device *dev)  	struct drm_crtc *crtc, *enabled = NULL;  	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { -		if (crtc->enabled && crtc->fb) { +		if (to_intel_crtc(crtc)->active && crtc->fb) {  			if (enabled)  				return NULL;  			enabled = crtc; @@ -1086,7 +1086,7 @@ static bool g4x_compute_wm0(struct drm_device *dev,  	int entries, tlb_miss;  	crtc = intel_get_crtc_for_plane(dev, plane); -	if (crtc->fb == NULL || !crtc->enabled) { +	if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {  		*cursor_wm = cursor->guard_size;  		*plane_wm = display->guard_size;  		return false; @@ -1215,7 +1215,7 @@ static bool vlv_compute_drain_latency(struct drm_device *dev,  	int entries;  	crtc = intel_get_crtc_for_plane(dev, plane); -	if (crtc->fb == NULL || !crtc->enabled) +	if (crtc->fb == NULL || !to_intel_crtc(crtc)->active)  		return false;  	clock = crtc->mode.clock;	/* VESA DOT Clock */ @@ -1286,6 +1286,7 @@ static void valleyview_update_wm(struct drm_device *dev)  	struct drm_i915_private *dev_priv = dev->dev_private;  	int planea_wm, planeb_wm, cursora_wm, cursorb_wm;  	int plane_sr, cursor_sr; +	int ignore_plane_sr, ignore_cursor_sr;  	unsigned int enabled = 0;  	vlv_update_drain_latency(dev); @@ -1302,17 +1303,23 @@ static void valleyview_update_wm(struct drm_device *dev)  			    &planeb_wm, &cursorb_wm))  		enabled |= 2; -	plane_sr = cursor_sr = 0;  	if (single_plane_enabled(enabled) &&  	    g4x_compute_srwm(dev, ffs(enabled) - 1,  			     sr_latency_ns,  			     &valleyview_wm_info,  			     &valleyview_cursor_wm_info, -			     &plane_sr, &cursor_sr)) +			     &plane_sr, &ignore_cursor_sr) && +	    g4x_compute_srwm(dev, ffs(enabled) - 1, +			     2*sr_latency_ns, +			     &valleyview_wm_info, +			     &valleyview_cursor_wm_info, +			     &ignore_plane_sr, &cursor_sr)) {  		I915_WRITE(FW_BLC_SELF_VLV, FW_CSPWRDWNEN); -	else +	} else {  		I915_WRITE(FW_BLC_SELF_VLV,  			   I915_READ(FW_BLC_SELF_VLV) & ~FW_CSPWRDWNEN); +		plane_sr = cursor_sr = 0; +	}  	DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",  		      planea_wm, cursora_wm, @@ -1352,17 +1359,18 @@ static void g4x_update_wm(struct drm_device *dev)  			    &planeb_wm, &cursorb_wm))  		enabled |= 2; -	plane_sr = cursor_sr = 0;  	if (single_plane_enabled(enabled) &&  	    g4x_compute_srwm(dev, ffs(enabled) - 1,  			     sr_latency_ns,  			     &g4x_wm_info,  			     &g4x_cursor_wm_info, -			     &plane_sr, &cursor_sr)) +			     &plane_sr, &cursor_sr)) {  		I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN); -	else +	} else {  		I915_WRITE(FW_BLC_SELF,  			   I915_READ(FW_BLC_SELF) & ~FW_BLC_SELF_EN); +		plane_sr = cursor_sr = 0; +	}  	DRM_DEBUG_KMS("Setting FIFO watermarks - A: plane=%d, cursor=%d, B: plane=%d, cursor=%d, SR: plane=%d, cursor=%d\n",  		      planea_wm, cursora_wm, @@ -1468,7 +1476,7 @@ static void i9xx_update_wm(struct drm_device *dev)  	fifo_size = dev_priv->display.get_fifo_size(dev, 0);  	crtc = intel_get_crtc_for_plane(dev, 0); -	if (crtc->enabled && crtc->fb) { +	if (to_intel_crtc(crtc)->active && crtc->fb) {  		int cpp = crtc->fb->bits_per_pixel / 8;  		if (IS_GEN2(dev))  			cpp = 4; @@ -1482,7 +1490,7 @@ static void i9xx_update_wm(struct drm_device *dev)  	fifo_size = dev_priv->display.get_fifo_size(dev, 1);  	crtc = intel_get_crtc_for_plane(dev, 1); -	if (crtc->enabled && crtc->fb) { +	if (to_intel_crtc(crtc)->active && crtc->fb) {  		int cpp = crtc->fb->bits_per_pixel / 8;  		if (IS_GEN2(dev))  			cpp = 4; @@ -1811,8 +1819,110 @@ static void sandybridge_update_wm(struct drm_device *dev)  		enabled |= 2;  	} -	if ((dev_priv->num_pipe == 3) && -	    g4x_compute_wm0(dev, 2, +	/* +	 * Calculate and update the self-refresh watermark only when one +	 * display plane is used. +	 * +	 * SNB support 3 levels of watermark. +	 * +	 * WM1/WM2/WM2 watermarks have to be enabled in the ascending order, +	 * and disabled in the descending order +	 * +	 */ +	I915_WRITE(WM3_LP_ILK, 0); +	I915_WRITE(WM2_LP_ILK, 0); +	I915_WRITE(WM1_LP_ILK, 0); + +	if (!single_plane_enabled(enabled) || +	    dev_priv->sprite_scaling_enabled) +		return; +	enabled = ffs(enabled) - 1; + +	/* WM1 */ +	if (!ironlake_compute_srwm(dev, 1, enabled, +				   SNB_READ_WM1_LATENCY() * 500, +				   &sandybridge_display_srwm_info, +				   &sandybridge_cursor_srwm_info, +				   &fbc_wm, &plane_wm, &cursor_wm)) +		return; + +	I915_WRITE(WM1_LP_ILK, +		   WM1_LP_SR_EN | +		   (SNB_READ_WM1_LATENCY() << WM1_LP_LATENCY_SHIFT) | +		   (fbc_wm << WM1_LP_FBC_SHIFT) | +		   (plane_wm << WM1_LP_SR_SHIFT) | +		   cursor_wm); + +	/* WM2 */ +	if (!ironlake_compute_srwm(dev, 2, enabled, +				   SNB_READ_WM2_LATENCY() * 500, +				   &sandybridge_display_srwm_info, +				   &sandybridge_cursor_srwm_info, +				   &fbc_wm, &plane_wm, &cursor_wm)) +		return; + +	I915_WRITE(WM2_LP_ILK, +		   WM2_LP_EN | +		   (SNB_READ_WM2_LATENCY() << WM1_LP_LATENCY_SHIFT) | +		   (fbc_wm << WM1_LP_FBC_SHIFT) | +		   (plane_wm << WM1_LP_SR_SHIFT) | +		   cursor_wm); + +	/* WM3 */ +	if (!ironlake_compute_srwm(dev, 3, enabled, +				   SNB_READ_WM3_LATENCY() * 500, +				   &sandybridge_display_srwm_info, +				   &sandybridge_cursor_srwm_info, +				   &fbc_wm, &plane_wm, &cursor_wm)) +		return; + +	I915_WRITE(WM3_LP_ILK, +		   WM3_LP_EN | +		   (SNB_READ_WM3_LATENCY() << WM1_LP_LATENCY_SHIFT) | +		   (fbc_wm << WM1_LP_FBC_SHIFT) | +		   (plane_wm << WM1_LP_SR_SHIFT) | +		   cursor_wm); +} + +static void ivybridge_update_wm(struct drm_device *dev) +{ +	struct drm_i915_private *dev_priv = dev->dev_private; +	int latency = SNB_READ_WM0_LATENCY() * 100;	/* In unit 0.1us */ +	u32 val; +	int fbc_wm, plane_wm, cursor_wm; +	int ignore_fbc_wm, ignore_plane_wm, ignore_cursor_wm; +	unsigned int enabled; + +	enabled = 0; +	if (g4x_compute_wm0(dev, 0, +			    &sandybridge_display_wm_info, latency, +			    &sandybridge_cursor_wm_info, latency, +			    &plane_wm, &cursor_wm)) { +		val = I915_READ(WM0_PIPEA_ILK); +		val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK); +		I915_WRITE(WM0_PIPEA_ILK, val | +			   ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm)); +		DRM_DEBUG_KMS("FIFO watermarks For pipe A -" +			      " plane %d, " "cursor: %d\n", +			      plane_wm, cursor_wm); +		enabled |= 1; +	} + +	if (g4x_compute_wm0(dev, 1, +			    &sandybridge_display_wm_info, latency, +			    &sandybridge_cursor_wm_info, latency, +			    &plane_wm, &cursor_wm)) { +		val = I915_READ(WM0_PIPEB_ILK); +		val &= ~(WM0_PIPE_PLANE_MASK | WM0_PIPE_CURSOR_MASK); +		I915_WRITE(WM0_PIPEB_ILK, val | +			   ((plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm)); +		DRM_DEBUG_KMS("FIFO watermarks For pipe B -" +			      " plane %d, cursor: %d\n", +			      plane_wm, cursor_wm); +		enabled |= 2; +	} + +	if (g4x_compute_wm0(dev, 2,  			    &sandybridge_display_wm_info, latency,  			    &sandybridge_cursor_wm_info, latency,  			    &plane_wm, &cursor_wm)) { @@ -1875,12 +1985,17 @@ static void sandybridge_update_wm(struct drm_device *dev)  		   (plane_wm << WM1_LP_SR_SHIFT) |  		   cursor_wm); -	/* WM3 */ +	/* WM3, note we have to correct the cursor latency */  	if (!ironlake_compute_srwm(dev, 3, enabled,  				   SNB_READ_WM3_LATENCY() * 500,  				   &sandybridge_display_srwm_info,  				   &sandybridge_cursor_srwm_info, -				   &fbc_wm, &plane_wm, &cursor_wm)) +				   &fbc_wm, &plane_wm, &ignore_cursor_wm) || +	    !ironlake_compute_srwm(dev, 3, enabled, +				   2 * SNB_READ_WM3_LATENCY() * 500, +				   &sandybridge_display_srwm_info, +				   &sandybridge_cursor_srwm_info, +				   &ignore_fbc_wm, &ignore_plane_wm, &cursor_wm))  		return;  	I915_WRITE(WM3_LP_ILK, @@ -1929,7 +2044,7 @@ sandybridge_compute_sprite_wm(struct drm_device *dev, int plane,  	int entries, tlb_miss;  	crtc = intel_get_crtc_for_plane(dev, plane); -	if (crtc->fb == NULL || !crtc->enabled) { +	if (crtc->fb == NULL || !to_intel_crtc(crtc)->active) {  		*sprite_wm = display->guard_size;  		return false;  	} @@ -3471,6 +3586,15 @@ static void gen6_init_clock_gating(struct drm_device *dev)  		   I915_READ(ILK_DISPLAY_CHICKEN2) |  		   ILK_ELPIN_409_SELECT); +	/* WaDisableHiZPlanesWhenMSAAEnabled */ +	I915_WRITE(_3D_CHICKEN, +		   _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); + +	/* WaSetupGtModeTdRowDispatch */ +	if (IS_SNB_GT1(dev)) +		I915_WRITE(GEN6_GT_MODE, +			   _MASKED_BIT_ENABLE(GEN6_TD_FOUR_ROW_DISPATCH_DISABLE)); +  	I915_WRITE(WM3_LP_ILK, 0);  	I915_WRITE(WM2_LP_ILK, 0);  	I915_WRITE(WM1_LP_ILK, 0); @@ -3999,7 +4123,7 @@ void intel_init_pm(struct drm_device *dev)  		} else if (IS_IVYBRIDGE(dev)) {  			/* FIXME: detect B0+ stepping and use auto training */  			if (SNB_READ_WM0_LATENCY()) { -				dev_priv->display.update_wm = sandybridge_update_wm; +				dev_priv->display.update_wm = ivybridge_update_wm;  				dev_priv->display.update_sprite_wm = sandybridge_update_sprite_wm;  			} else {  				DRM_DEBUG_KMS("Failed to read display plane latency. " diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 2346b920bd8..ae253e04c39 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -547,9 +547,14 @@ static int init_render_ring(struct intel_ring_buffer *ring)  static void render_ring_cleanup(struct intel_ring_buffer *ring)  { +	struct drm_device *dev = ring->dev; +  	if (!ring->private)  		return; +	if (HAS_BROKEN_CS_TLB(dev)) +		drm_gem_object_unreference(to_gem_object(ring->private)); +  	cleanup_pipe_control(ring);  } @@ -969,6 +974,8 @@ i965_dispatch_execbuffer(struct intel_ring_buffer *ring,  	return 0;  } +/* Just userspace ABI convention to limit the wa batch bo to a resonable size */ +#define I830_BATCH_LIMIT (256*1024)  static int  i830_dispatch_execbuffer(struct intel_ring_buffer *ring,  				u32 offset, u32 len, @@ -976,15 +983,47 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,  {  	int ret; -	ret = intel_ring_begin(ring, 4); -	if (ret) -		return ret; +	if (flags & I915_DISPATCH_PINNED) { +		ret = intel_ring_begin(ring, 4); +		if (ret) +			return ret; -	intel_ring_emit(ring, MI_BATCH_BUFFER); -	intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); -	intel_ring_emit(ring, offset + len - 8); -	intel_ring_emit(ring, 0); -	intel_ring_advance(ring); +		intel_ring_emit(ring, MI_BATCH_BUFFER); +		intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); +		intel_ring_emit(ring, offset + len - 8); +		intel_ring_emit(ring, MI_NOOP); +		intel_ring_advance(ring); +	} else { +		struct drm_i915_gem_object *obj = ring->private; +		u32 cs_offset = obj->gtt_offset; + +		if (len > I830_BATCH_LIMIT) +			return -ENOSPC; + +		ret = intel_ring_begin(ring, 9+3); +		if (ret) +			return ret; +		/* Blit the batch (which has now all relocs applied) to the stable batch +		 * scratch bo area (so that the CS never stumbles over its tlb +		 * invalidation bug) ... */ +		intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD | +				XY_SRC_COPY_BLT_WRITE_ALPHA | +				XY_SRC_COPY_BLT_WRITE_RGB); +		intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096); +		intel_ring_emit(ring, 0); +		intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024); +		intel_ring_emit(ring, cs_offset); +		intel_ring_emit(ring, 0); +		intel_ring_emit(ring, 4096); +		intel_ring_emit(ring, offset); +		intel_ring_emit(ring, MI_FLUSH); + +		/* ... and execute it. */ +		intel_ring_emit(ring, MI_BATCH_BUFFER); +		intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); +		intel_ring_emit(ring, cs_offset + len - 8); +		intel_ring_advance(ring); +	}  	return 0;  } @@ -1596,6 +1635,27 @@ int intel_init_render_ring_buffer(struct drm_device *dev)  	ring->init = init_render_ring;  	ring->cleanup = render_ring_cleanup; +	/* Workaround batchbuffer to combat CS tlb bug. */ +	if (HAS_BROKEN_CS_TLB(dev)) { +		struct drm_i915_gem_object *obj; +		int ret; + +		obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT); +		if (obj == NULL) { +			DRM_ERROR("Failed to allocate batch bo\n"); +			return -ENOMEM; +		} + +		ret = i915_gem_object_pin(obj, 0, true, false); +		if (ret != 0) { +			drm_gem_object_unreference(&obj->base); +			DRM_ERROR("Failed to ping batch bo\n"); +			return ret; +		} + +		ring->private = obj; +	} +  	return intel_init_ring_buffer(dev, ring);  } diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 526182ed0c6..6af87cd0572 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -94,6 +94,7 @@ struct  intel_ring_buffer {  					       u32 offset, u32 length,  					       unsigned flags);  #define I915_DISPATCH_SECURE 0x1 +#define I915_DISPATCH_PINNED 0x2  	void		(*cleanup)(struct intel_ring_buffer *ring);  	int		(*sync_to)(struct intel_ring_buffer *ring,  				   struct intel_ring_buffer *to, diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc index 7b715fda276..62ab231cd6b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc @@ -57,6 +57,11 @@ chipsets:  .b16 #nve4_gpc_mmio_tail  .b16 #nve4_tpc_mmio_head  .b16 #nve4_tpc_mmio_tail +.b8  0xe6 0 0 0 +.b16 #nve4_gpc_mmio_head +.b16 #nve4_gpc_mmio_tail +.b16 #nve4_tpc_mmio_head +.b16 #nve4_tpc_mmio_tail  .b8  0 0 0 0  // GPC mmio lists diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h index 26c2165bad0..09ee4702c8b 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/gpcnve0.fuc.h @@ -34,13 +34,16 @@ uint32_t nve0_grgpc_data[] = {  	0x00000000,  /* 0x0064: chipsets */  	0x000000e4, -	0x01040080, -	0x014c0104, +	0x0110008c, +	0x01580110,  	0x000000e7, -	0x01040080, -	0x014c0104, +	0x0110008c, +	0x01580110, +	0x000000e6, +	0x0110008c, +	0x01580110,  	0x00000000, -/* 0x0080: nve4_gpc_mmio_head */ +/* 0x008c: nve4_gpc_mmio_head */  	0x00000380,  	0x04000400,  	0x0800040c, @@ -74,8 +77,8 @@ uint32_t nve0_grgpc_data[] = {  	0x14003100,  	0x000031d0,  	0x040031e0, -/* 0x0104: nve4_gpc_mmio_tail */ -/* 0x0104: nve4_tpc_mmio_head */ +/* 0x0110: nve4_gpc_mmio_tail */ +/* 0x0110: nve4_tpc_mmio_head */  	0x00000048,  	0x00000064,  	0x00000088, diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc index acfc457654b..0bcfa4d447e 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc @@ -754,6 +754,16 @@ ctx_mmio_exec:  //		on load it means: "a save preceeded this load"  //  ctx_xfer: +	// according to mwk, some kind of wait for idle +	mov $r15 0xc00 +	shl b32 $r15 6 +	mov $r14 4 +	iowr I[$r15 + 0x200] $r14 +	ctx_xfer_idle: +		iord $r14 I[$r15 + 0x000] +		and $r14 0x2000 +		bra ne #ctx_xfer_idle +  	bra not $p1 #ctx_xfer_pre  	bra $p2 #ctx_xfer_pre_load  	ctx_xfer_pre: diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h index 85a8d556f48..bb03d2a1d57 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnvc0.fuc.h @@ -799,79 +799,80 @@ uint32_t nvc0_grhub_code[] = {  	0x01fa0613,  	0xf803f806,  /* 0x0829: ctx_xfer */ -	0x0611f400, -/* 0x082f: ctx_xfer_pre */ -	0xf01102f4, -	0x21f510f7, -	0x21f50698, -	0x11f40631, -/* 0x083d: ctx_xfer_pre_load */ -	0x02f7f01c, -	0x065721f5, -	0x066621f5, -	0x067821f5, -	0x21f5f4bd, -	0x21f50657, -/* 0x0856: ctx_xfer_exec */ -	0x019806b8, -	0x1427f116, -	0x0624b604, -	0xf10020d0, -	0xf0a500e7, -	0x1fb941e3, -	0x8d21f402, -	0xf004e0b6, -	0x2cf001fc, -	0x0124b602, -	0xf405f2fd, -	0x17f18d21, -	0x13f04afc, -	0x0c27f002, -	0xf50012d0, -	0xf1020721, -	0xf047fc27, -	0x20d00223, -	0x012cf000, -	0xd00320b6, -	0xacf00012, -	0x06a5f001, -	0x9800b7f0, -	0x0d98140c, -	0x00e7f015, -	0x015c21f5, -	0xf508a7f0, -	0xf5010321, -	0xf4020721, -	0xa7f02201, -	0xc921f40c, -	0x0a1017f1, -	0xf00614b6, -	0x12d00527, -/* 0x08dd: ctx_xfer_post_save_wait */ -	0x0012cf00, -	0xf40522fd, -	0x02f4fa1b, -/* 0x08e9: ctx_xfer_post */ -	0x02f7f032, -	0x065721f5, -	0x21f5f4bd, -	0x21f50698, -	0x21f50226, -	0xf4bd0666, -	0x065721f5, -	0x981011f4, -	0x11fd8001, -	0x070bf405, -	0x07df21f5, -/* 0x0914: ctx_xfer_no_post_mmio */ -	0x064921f5, -/* 0x0918: ctx_xfer_done */ -	0x000000f8, -	0x00000000, -	0x00000000, -	0x00000000, -	0x00000000, -	0x00000000, +	0x00f7f100, +	0x06f4b60c, +	0xd004e7f0, +/* 0x0836: ctx_xfer_idle */ +	0xfecf80fe, +	0x00e4f100, +	0xf91bf420, +	0xf40611f4, +/* 0x0846: ctx_xfer_pre */ +	0xf7f01102, +	0x9821f510, +	0x3121f506, +	0x1c11f406, +/* 0x0854: ctx_xfer_pre_load */ +	0xf502f7f0, +	0xf5065721, +	0xf5066621, +	0xbd067821, +	0x5721f5f4, +	0xb821f506, +/* 0x086d: ctx_xfer_exec */ +	0x16019806, +	0x041427f1, +	0xd00624b6, +	0xe7f10020, +	0xe3f0a500, +	0x021fb941, +	0xb68d21f4, +	0xfcf004e0, +	0x022cf001, +	0xfd0124b6, +	0x21f405f2, +	0xfc17f18d, +	0x0213f04a, +	0xd00c27f0, +	0x21f50012, +	0x27f10207, +	0x23f047fc, +	0x0020d002, +	0xb6012cf0, +	0x12d00320, +	0x01acf000, +	0xf006a5f0, +	0x0c9800b7, +	0x150d9814, +	0xf500e7f0, +	0xf0015c21, +	0x21f508a7, +	0x21f50103, +	0x01f40207, +	0x0ca7f022, +	0xf1c921f4, +	0xb60a1017, +	0x27f00614, +	0x0012d005, +/* 0x08f4: ctx_xfer_post_save_wait */ +	0xfd0012cf, +	0x1bf40522, +	0x3202f4fa, +/* 0x0900: ctx_xfer_post */ +	0xf502f7f0, +	0xbd065721, +	0x9821f5f4, +	0x2621f506, +	0x6621f502, +	0xf5f4bd06, +	0xf4065721, +	0x01981011, +	0x0511fd80, +	0xf5070bf4, +/* 0x092b: ctx_xfer_no_post_mmio */ +	0xf507df21, +/* 0x092f: ctx_xfer_done */ +	0xf8064921,  	0x00000000,  	0x00000000,  	0x00000000, diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc index 138eeaa2866..7fe9d7cf486 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc @@ -44,6 +44,9 @@ chipsets:  .b8  0xe7 0 0 0  .b16 #nve4_hub_mmio_head  .b16 #nve4_hub_mmio_tail +.b8  0xe6 0 0 0 +.b16 #nve4_hub_mmio_head +.b16 #nve4_hub_mmio_tail  .b8  0 0 0 0  nve4_hub_mmio_head: @@ -680,6 +683,16 @@ ctx_mmio_exec:  //		on load it means: "a save preceeded this load"  //  ctx_xfer: +	// according to mwk, some kind of wait for idle +	mov $r15 0xc00 +	shl b32 $r15 6 +	mov $r14 4 +	iowr I[$r15 + 0x200] $r14 +	ctx_xfer_idle: +		iord $r14 I[$r15 + 0x000] +		and $r14 0x2000 +		bra ne #ctx_xfer_idle +  	bra not $p1 #ctx_xfer_pre  	bra $p2 #ctx_xfer_pre_load  	ctx_xfer_pre: diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h index decf0c60ca3..e3421af68ab 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/fuc/hubnve0.fuc.h @@ -30,11 +30,13 @@ uint32_t nve0_grhub_data[] = {  	0x00000000,  /* 0x005c: chipsets */  	0x000000e4, -	0x013c0070, +	0x01440078,  	0x000000e7, -	0x013c0070, +	0x01440078, +	0x000000e6, +	0x01440078,  	0x00000000, -/* 0x0070: nve4_hub_mmio_head */ +/* 0x0078: nve4_hub_mmio_head */  	0x0417e91c,  	0x04400204,  	0x18404010, @@ -86,9 +88,7 @@ uint32_t nve0_grhub_data[] = {  	0x00408840,  	0x08408900,  	0x00408980, -/* 0x013c: nve4_hub_mmio_tail */ -	0x00000000, -	0x00000000, +/* 0x0144: nve4_hub_mmio_tail */  	0x00000000,  	0x00000000,  	0x00000000, @@ -781,77 +781,78 @@ uint32_t nve0_grhub_code[] = {  	0x0613f002,  	0xf80601fa,  /* 0x07fb: ctx_xfer */ -	0xf400f803, -	0x02f40611, -/* 0x0801: ctx_xfer_pre */ -	0x10f7f00d, -	0x067221f5, -/* 0x080b: ctx_xfer_pre_load */ -	0xf01c11f4, -	0x21f502f7, -	0x21f50631, -	0x21f50640, -	0xf4bd0652, -	0x063121f5, -	0x069221f5, -/* 0x0824: ctx_xfer_exec */ -	0xf1160198, -	0xb6041427, -	0x20d00624, -	0x00e7f100, -	0x41e3f0a5, -	0xf4021fb9, -	0xe0b68d21, -	0x01fcf004, -	0xb6022cf0, -	0xf2fd0124, -	0x8d21f405, -	0x4afc17f1, -	0xf00213f0, -	0x12d00c27, -	0x0721f500, -	0xfc27f102, -	0x0223f047, -	0xf00020d0, -	0x20b6012c, -	0x0012d003, -	0xf001acf0, -	0xb7f006a5, -	0x140c9800, -	0xf0150d98, -	0x21f500e7, -	0xa7f0015c, -	0x0321f508, -	0x0721f501, -	0x2201f402, -	0xf40ca7f0, -	0x17f1c921, -	0x14b60a10, -	0x0527f006, -/* 0x08ab: ctx_xfer_post_save_wait */ -	0xcf0012d0, -	0x22fd0012, -	0xfa1bf405, -/* 0x08b7: ctx_xfer_post */ -	0xf02e02f4, -	0x21f502f7, -	0xf4bd0631, -	0x067221f5, -	0x022621f5, -	0x064021f5, -	0x21f5f4bd, -	0x11f40631, -	0x80019810, -	0xf40511fd, -	0x21f5070b, -/* 0x08e2: ctx_xfer_no_post_mmio */ -/* 0x08e2: ctx_xfer_done */ -	0x00f807b1, -	0x00000000, -	0x00000000, -	0x00000000, -	0x00000000, -	0x00000000, -	0x00000000, +	0xf100f803, +	0xb60c00f7, +	0xe7f006f4, +	0x80fed004, +/* 0x0808: ctx_xfer_idle */ +	0xf100fecf, +	0xf42000e4, +	0x11f4f91b, +	0x0d02f406, +/* 0x0818: ctx_xfer_pre */ +	0xf510f7f0, +	0xf4067221, +/* 0x0822: ctx_xfer_pre_load */ +	0xf7f01c11, +	0x3121f502, +	0x4021f506, +	0x5221f506, +	0xf5f4bd06, +	0xf5063121, +/* 0x083b: ctx_xfer_exec */ +	0x98069221, +	0x27f11601, +	0x24b60414, +	0x0020d006, +	0xa500e7f1, +	0xb941e3f0, +	0x21f4021f, +	0x04e0b68d, +	0xf001fcf0, +	0x24b6022c, +	0x05f2fd01, +	0xf18d21f4, +	0xf04afc17, +	0x27f00213, +	0x0012d00c, +	0x020721f5, +	0x47fc27f1, +	0xd00223f0, +	0x2cf00020, +	0x0320b601, +	0xf00012d0, +	0xa5f001ac, +	0x00b7f006, +	0x98140c98, +	0xe7f0150d, +	0x5c21f500, +	0x08a7f001, +	0x010321f5, +	0x020721f5, +	0xf02201f4, +	0x21f40ca7, +	0x1017f1c9, +	0x0614b60a, +	0xd00527f0, +/* 0x08c2: ctx_xfer_post_save_wait */ +	0x12cf0012, +	0x0522fd00, +	0xf4fa1bf4, +/* 0x08ce: ctx_xfer_post */ +	0xf7f02e02, +	0x3121f502, +	0xf5f4bd06, +	0xf5067221, +	0xf5022621, +	0xbd064021, +	0x3121f5f4, +	0x1011f406, +	0xfd800198, +	0x0bf40511, +	0xb121f507, +/* 0x08f9: ctx_xfer_no_post_mmio */ +/* 0x08f9: ctx_xfer_done */ +	0x0000f807,  	0x00000000,  }; diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c index 47a02081d70..45aff5f5085 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.c @@ -516,18 +516,9 @@ nvc0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,  {  	struct nouveau_device *device = nv_device(parent);  	struct nvc0_graph_priv *priv; -	bool enable = true;  	int ret, i; -	switch (device->chipset) { -	case 0xd9: /* known broken without binary driver firmware */ -		enable = false; -		break; -	default: -		break; -	} - -	ret = nouveau_graph_create(parent, engine, oclass, enable, &priv); +	ret = nouveau_graph_create(parent, engine, oclass, true, &priv);  	*pobject = nv_object(priv);  	if (ret)  		return ret; diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h index 18d2210e12e..a1e78de4645 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nvc0.h @@ -121,6 +121,7 @@ nvc0_graph_class(void *obj)  		return 0x9297;  	case 0xe4:  	case 0xe7: +	case 0xe6:  		return 0xa097;  	default:  		return 0; diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c index 539d4c72f19..9f82e9702b4 100644 --- a/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c +++ b/drivers/gpu/drm/nouveau/core/engine/graph/nve0.c @@ -203,7 +203,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,  	struct nvc0_graph_priv *priv;  	int ret, i; -	ret = nouveau_graph_create(parent, engine, oclass, false, &priv); +	ret = nouveau_graph_create(parent, engine, oclass, true, &priv);  	*pobject = nv_object(priv);  	if (ret)  		return ret; @@ -252,6 +252,7 @@ nve0_graph_ctor(struct nouveau_object *parent, struct nouveau_object *engine,  			priv->magic_not_rop_nr = 1;  		break;  	case 0xe7: +	case 0xe6:  		priv->magic_not_rop_nr = 1;  		break;  	default: diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h index d145b25e6be..5bd1ca8cd20 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/bios.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios.h @@ -17,6 +17,7 @@ struct nouveau_bios {  		u8 chip;  		u8 minor;  		u8 micro; +		u8 patch;  	} version;  }; diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h index 2bf178082a3..e6563b5cb08 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h @@ -25,9 +25,11 @@ struct dcb_gpio_func {  	u8 param;  }; -u16 dcb_gpio_table(struct nouveau_bios *); -u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver); -int dcb_gpio_parse(struct nouveau_bios *, int idx, u8 func, u8 line, +u16 dcb_gpio_table(struct nouveau_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); +u16 dcb_gpio_entry(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len); +u16 dcb_gpio_parse(struct nouveau_bios *, int idx, int ent, u8 *ver, u8 *len,  		   struct dcb_gpio_func *); +u16 dcb_gpio_match(struct nouveau_bios *, int idx, u8 func, u8 line, +		   u8 *ver, u8 *len, struct dcb_gpio_func *);  #endif diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h index e69a8bdc6e9..ca2f6bf37f4 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/bios/init.h @@ -13,6 +13,7 @@ struct nvbios_init {  	u32 nested;  	u16 repeat;  	u16 repend; +	u32 ramcfg;  };  int nvbios_exec(struct nvbios_init *); diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h index 9ea2b12cc15..b75e8f18e52 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/gpio.h @@ -11,7 +11,7 @@ struct nouveau_gpio {  	struct nouveau_subdev base;  	/* hardware interfaces */ -	void (*reset)(struct nouveau_gpio *); +	void (*reset)(struct nouveau_gpio *, u8 func);  	int  (*drive)(struct nouveau_gpio *, int line, int dir, int out);  	int  (*sense)(struct nouveau_gpio *, int line);  	void (*irq_enable)(struct nouveau_gpio *, int line, bool); diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index dd111947eb8..f621f69fa1a 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c @@ -447,6 +447,7 @@ nouveau_bios_ctor(struct nouveau_object *parent,  		bios->version.chip  = nv_ro08(bios, bit_i.offset + 2);  		bios->version.minor = nv_ro08(bios, bit_i.offset + 1);  		bios->version.micro = nv_ro08(bios, bit_i.offset + 0); +		bios->version.patch = nv_ro08(bios, bit_i.offset + 4);  	} else  	if (bmp_version(bios)) {  		bios->version.major = nv_ro08(bios, bios->bmp_offset + 13); @@ -455,9 +456,9 @@ nouveau_bios_ctor(struct nouveau_object *parent,  		bios->version.micro = nv_ro08(bios, bios->bmp_offset + 10);  	} -	nv_info(bios, "version %02x.%02x.%02x.%02x\n", +	nv_info(bios, "version %02x.%02x.%02x.%02x.%02x\n",  		bios->version.major, bios->version.chip, -		bios->version.minor, bios->version.micro); +		bios->version.minor, bios->version.micro, bios->version.patch);  	return 0;  } diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c index c90d4aa3ae4..c84e93fa6d9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c @@ -27,84 +27,105 @@  #include <subdev/bios/gpio.h>  u16 -dcb_gpio_table(struct nouveau_bios *bios) +dcb_gpio_table(struct nouveau_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)  { -	u8  ver, hdr, cnt, len; -	u16 dcb = dcb_table(bios, &ver, &hdr, &cnt, &len); +	u16 data = 0x0000; +	u16 dcb = dcb_table(bios, ver, hdr, cnt, len);  	if (dcb) { -		if (ver >= 0x30 && hdr >= 0x0c) -			return nv_ro16(bios, dcb + 0x0a); -		if (ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13) -			return nv_ro16(bios, dcb - 0x0f); +		if (*ver >= 0x30 && *hdr >= 0x0c) +			data = nv_ro16(bios, dcb + 0x0a); +		else +		if (*ver >= 0x22 && nv_ro08(bios, dcb - 1) >= 0x13) +			data = nv_ro16(bios, dcb - 0x0f); + +		if (data) { +			*ver = nv_ro08(bios, data + 0x00); +			if (*ver < 0x30) { +				*hdr = 3; +				*cnt = nv_ro08(bios, data + 0x02); +				*len = nv_ro08(bios, data + 0x01); +			} else +			if (*ver <= 0x41) { +				*hdr = nv_ro08(bios, data + 0x01); +				*cnt = nv_ro08(bios, data + 0x02); +				*len = nv_ro08(bios, data + 0x03); +			} else { +				data = 0x0000; +			} +		}  	} -	return 0x0000; +	return data;  }  u16 -dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver) +dcb_gpio_entry(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len)  { -	u16 gpio = dcb_gpio_table(bios); -	if (gpio) { -		*ver = nv_ro08(bios, gpio); -		if (*ver < 0x30 && ent < nv_ro08(bios, gpio + 2)) -			return gpio + 3 + (ent * nv_ro08(bios, gpio + 1)); -		else if (ent < nv_ro08(bios, gpio + 2)) -			return gpio + nv_ro08(bios, gpio + 1) + -			       (ent * nv_ro08(bios, gpio + 3)); -	} +	u8  hdr, cnt; +	u16 gpio = !idx ? dcb_gpio_table(bios, ver, &hdr, &cnt, len) : 0x0000; +	if (gpio && ent < cnt) +		return gpio + hdr + (ent * *len);  	return 0x0000;  } -int -dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line, +u16 +dcb_gpio_parse(struct nouveau_bios *bios, int idx, int ent, u8 *ver, u8 *len,  	       struct dcb_gpio_func *gpio)  { -	u8  ver, hdr, cnt, len; -	u16 entry; -	int i = -1; - -	while ((entry = dcb_gpio_entry(bios, idx, ++i, &ver))) { -		if (ver < 0x40) { -			u16 data = nv_ro16(bios, entry); +	u16 data = dcb_gpio_entry(bios, idx, ent, ver, len); +	if (data) { +		if (*ver < 0x40) { +			u16 info = nv_ro16(bios, data);  			*gpio = (struct dcb_gpio_func) { -				.line = (data & 0x001f) >> 0, -				.func = (data & 0x07e0) >> 5, -				.log[0] = (data & 0x1800) >> 11, -				.log[1] = (data & 0x6000) >> 13, -				.param = !!(data & 0x8000), +				.line = (info & 0x001f) >> 0, +				.func = (info & 0x07e0) >> 5, +				.log[0] = (info & 0x1800) >> 11, +				.log[1] = (info & 0x6000) >> 13, +				.param = !!(info & 0x8000),  			};  		} else -		if (ver < 0x41) { -			u32 data = nv_ro32(bios, entry); +		if (*ver < 0x41) { +			u32 info = nv_ro32(bios, data);  			*gpio = (struct dcb_gpio_func) { -				.line = (data & 0x0000001f) >> 0, -				.func = (data & 0x0000ff00) >> 8, -				.log[0] = (data & 0x18000000) >> 27, -				.log[1] = (data & 0x60000000) >> 29, -				.param = !!(data & 0x80000000), +				.line = (info & 0x0000001f) >> 0, +				.func = (info & 0x0000ff00) >> 8, +				.log[0] = (info & 0x18000000) >> 27, +				.log[1] = (info & 0x60000000) >> 29, +				.param = !!(info & 0x80000000),  			};  		} else { -			u32 data = nv_ro32(bios, entry + 0); -			u8 data1 = nv_ro32(bios, entry + 4); +			u32 info = nv_ro32(bios, data + 0); +			u8 info1 = nv_ro32(bios, data + 4);  			*gpio = (struct dcb_gpio_func) { -				.line = (data & 0x0000003f) >> 0, -				.func = (data & 0x0000ff00) >> 8, -				.log[0] = (data1 & 0x30) >> 4, -				.log[1] = (data1 & 0xc0) >> 6, -				.param = !!(data & 0x80000000), +				.line = (info & 0x0000003f) >> 0, +				.func = (info & 0x0000ff00) >> 8, +				.log[0] = (info1 & 0x30) >> 4, +				.log[1] = (info1 & 0xc0) >> 6, +				.param = !!(info & 0x80000000),  			};  		} +	} + +	return data; +} +u16 +dcb_gpio_match(struct nouveau_bios *bios, int idx, u8 func, u8 line, +	       u8 *ver, u8 *len, struct dcb_gpio_func *gpio) +{ +	u8  hdr, cnt, i = 0; +	u16 data; + +	while ((data = dcb_gpio_parse(bios, idx, i++, ver, len, gpio))) {  		if ((line == 0xff || line == gpio->line) &&  		    (func == 0xff || func == gpio->func)) -			return 0; +			return data;  	}  	/* DCB 2.2, fixed TVDAC GPIO data */ -	if ((entry = dcb_table(bios, &ver, &hdr, &cnt, &len))) { -		if (ver >= 0x22 && ver < 0x30 && func == DCB_GPIO_TVDAC0) { -			u8 conf = nv_ro08(bios, entry - 5); -			u8 addr = nv_ro08(bios, entry - 4); +	if ((data = dcb_table(bios, ver, &hdr, &cnt, len))) { +		if (*ver >= 0x22 && *ver < 0x30 && func == DCB_GPIO_TVDAC0) { +			u8 conf = nv_ro08(bios, data - 5); +			u8 addr = nv_ro08(bios, data - 4);  			if (conf & 0x01) {  				*gpio = (struct dcb_gpio_func) {  					.func = DCB_GPIO_TVDAC0, @@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,  					.log[0] = !!(conf & 0x02),  					.log[1] =  !(conf & 0x02),  				}; -				return 0; +				*ver = 0x00; +				return data;  			}  		}  	} -	return -EINVAL; +	return 0x0000;  } diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c index ae168bbb86d..2917d552689 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/init.c @@ -2,11 +2,12 @@  #include <core/device.h>  #include <subdev/bios.h> -#include <subdev/bios/conn.h>  #include <subdev/bios/bmp.h>  #include <subdev/bios/bit.h> +#include <subdev/bios/conn.h>  #include <subdev/bios/dcb.h>  #include <subdev/bios/dp.h> +#include <subdev/bios/gpio.h>  #include <subdev/bios/init.h>  #include <subdev/devinit.h>  #include <subdev/clock.h> @@ -410,9 +411,25 @@ init_ram_restrict_group_count(struct nvbios_init *init)  }  static u8 +init_ram_restrict_strap(struct nvbios_init *init) +{ +	/* This appears to be the behaviour of the VBIOS parser, and *is* +	 * important to cache the NV_PEXTDEV_BOOT0 on later chipsets to +	 * avoid fucking up the memory controller (somehow) by reading it +	 * on every INIT_RAM_RESTRICT_ZM_GROUP opcode. +	 * +	 * Preserving the non-caching behaviour on earlier chipsets just +	 * in case *not* re-reading the strap causes similar breakage. +	 */ +	if (!init->ramcfg || init->bios->version.major < 0x70) +		init->ramcfg = init_rd32(init, 0x101000); +	return (init->ramcfg & 0x00000003c) >> 2; +} + +static u8  init_ram_restrict(struct nvbios_init *init)  { -	u32 strap = (init_rd32(init, 0x101000) & 0x0000003c) >> 2; +	u8  strap = init_ram_restrict_strap(init);  	u16 table = init_ram_restrict_table(init);  	if (table)  		return nv_ro08(init->bios, table + strap); @@ -1781,7 +1798,7 @@ init_gpio(struct nvbios_init *init)  	init->offset += 1;  	if (init_exec(init) && gpio && gpio->reset) -		gpio->reset(gpio); +		gpio->reset(gpio, DCB_GPIO_UNUSED);  }  /** @@ -1995,6 +2012,47 @@ init_i2c_long_if(struct nvbios_init *init)  	init_exec_set(init, false);  } +/** + * INIT_GPIO_NE - opcode 0xa9 + * + */ +static void +init_gpio_ne(struct nvbios_init *init) +{ +	struct nouveau_bios *bios = init->bios; +	struct nouveau_gpio *gpio = nouveau_gpio(bios); +	struct dcb_gpio_func func; +	u8 count = nv_ro08(bios, init->offset + 1); +	u8 idx = 0, ver, len; +	u16 data, i; + +	trace("GPIO_NE\t"); +	init->offset += 2; + +	for (i = init->offset; i < init->offset + count; i++) +		cont("0x%02x ", nv_ro08(bios, i)); +	cont("\n"); + +	while ((data = dcb_gpio_parse(bios, 0, idx++, &ver, &len, &func))) { +		if (func.func != DCB_GPIO_UNUSED) { +			for (i = init->offset; i < init->offset + count; i++) { +				if (func.func == nv_ro08(bios, i)) +					break; +			} + +			trace("\tFUNC[0x%02x]", func.func); +			if (i == (init->offset + count)) { +				cont(" *"); +				if (init_exec(init) && gpio && gpio->reset) +					gpio->reset(gpio, func.func); +			} +			cont("\n"); +		} +	} + +	init->offset += count; +} +  static struct nvbios_init_opcode {  	void (*exec)(struct nvbios_init *);  } init_opcode[] = { @@ -2059,6 +2117,7 @@ static struct nvbios_init_opcode {  	[0x98] = { init_auxch },  	[0x99] = { init_zm_auxch },  	[0x9a] = { init_i2c_long_if }, +	[0xa9] = { init_gpio_ne },  };  #define init_opcode_nr (sizeof(init_opcode) / sizeof(init_opcode[0])) diff --git a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c index 9b7881e7663..03a652876e7 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/device/nve0.c @@ -109,6 +109,34 @@ nve0_identify(struct nouveau_device *device)  		device->oclass[NVDEV_ENGINE_VP     ] = &nve0_vp_oclass;  		device->oclass[NVDEV_ENGINE_PPP    ] = &nvc0_ppp_oclass;  		break; +	case 0xe6: +		device->cname = "GK106"; +		device->oclass[NVDEV_SUBDEV_VBIOS  ] = &nouveau_bios_oclass; +		device->oclass[NVDEV_SUBDEV_GPIO   ] = &nvd0_gpio_oclass; +		device->oclass[NVDEV_SUBDEV_I2C    ] = &nouveau_i2c_oclass; +		device->oclass[NVDEV_SUBDEV_CLOCK  ] = &nvc0_clock_oclass; +		device->oclass[NVDEV_SUBDEV_THERM  ] = &nv50_therm_oclass; +		device->oclass[NVDEV_SUBDEV_MXM    ] = &nv50_mxm_oclass; +		device->oclass[NVDEV_SUBDEV_DEVINIT] = &nv50_devinit_oclass; +		device->oclass[NVDEV_SUBDEV_MC     ] = &nvc0_mc_oclass; +		device->oclass[NVDEV_SUBDEV_TIMER  ] = &nv04_timer_oclass; +		device->oclass[NVDEV_SUBDEV_FB     ] = &nvc0_fb_oclass; +		device->oclass[NVDEV_SUBDEV_LTCG   ] = &nvc0_ltcg_oclass; +		device->oclass[NVDEV_SUBDEV_IBUS   ] = &nve0_ibus_oclass; +		device->oclass[NVDEV_SUBDEV_INSTMEM] = &nv50_instmem_oclass; +		device->oclass[NVDEV_SUBDEV_VM     ] = &nvc0_vmmgr_oclass; +		device->oclass[NVDEV_SUBDEV_BAR    ] = &nvc0_bar_oclass; +		device->oclass[NVDEV_ENGINE_DMAOBJ ] = &nvd0_dmaeng_oclass; +		device->oclass[NVDEV_ENGINE_FIFO   ] = &nve0_fifo_oclass; +		device->oclass[NVDEV_ENGINE_SW     ] = &nvc0_software_oclass; +		device->oclass[NVDEV_ENGINE_GR     ] = &nve0_graph_oclass; +		device->oclass[NVDEV_ENGINE_DISP   ] = &nve0_disp_oclass; +		device->oclass[NVDEV_ENGINE_COPY0  ] = &nve0_copy0_oclass; +		device->oclass[NVDEV_ENGINE_COPY1  ] = &nve0_copy1_oclass; +		device->oclass[NVDEV_ENGINE_BSP    ] = &nve0_bsp_oclass; +		device->oclass[NVDEV_ENGINE_VP     ] = &nve0_vp_oclass; +		device->oclass[NVDEV_ENGINE_PPP    ] = &nvc0_ppp_oclass; +		break;  	default:  		nv_fatal(device, "unknown Kepler chipset\n");  		return -EINVAL; diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c index acf818c58bf..9fb0f9b92d4 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/base.c @@ -43,10 +43,15 @@ static int  nouveau_gpio_find(struct nouveau_gpio *gpio, int idx, u8 tag, u8 line,  		  struct dcb_gpio_func *func)  { +	struct nouveau_bios *bios = nouveau_bios(gpio); +	u8  ver, len; +	u16 data; +  	if (line == 0xff && tag == 0xff)  		return -EINVAL; -	if (!dcb_gpio_parse(nouveau_bios(gpio), idx, tag, line, func)) +	data = dcb_gpio_match(bios, idx, tag, line, &ver, &len, func); +	if (data)  		return 0;  	/* Apple iMac G4 NV18 */ @@ -265,7 +270,7 @@ nouveau_gpio_init(struct nouveau_gpio *gpio)  	int ret = nouveau_subdev_init(&gpio->base);  	if (ret == 0 && gpio->reset) {  		if (dmi_check_system(gpio_reset_ids)) -			gpio->reset(gpio); +			gpio->reset(gpio, DCB_GPIO_UNUSED);  	}  	return ret;  } diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c index f3502c961cd..bf13a1200f2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c @@ -29,15 +29,15 @@ struct nv50_gpio_priv {  };  static void -nv50_gpio_reset(struct nouveau_gpio *gpio) +nv50_gpio_reset(struct nouveau_gpio *gpio, u8 match)  {  	struct nouveau_bios *bios = nouveau_bios(gpio);  	struct nv50_gpio_priv *priv = (void *)gpio; +	u8 ver, len;  	u16 entry; -	u8 ver;  	int ent = -1; -	while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { +	while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {  		static const u32 regs[] = { 0xe100, 0xe28c };  		u32 data = nv_ro32(bios, entry);  		u8  line =   (data & 0x0000001f); @@ -48,7 +48,8 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)  		u32 val = (unk1 << 16) | unk0;  		u32 reg = regs[line >> 4]; line &= 0x0f; -		if (func == 0xff) +		if ( func  == DCB_GPIO_UNUSED || +		    (match != DCB_GPIO_UNUSED && match != func))  			continue;  		gpio->set(gpio, 0, func, line, defs); diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c index 8d18fcad26e..83e8b8f16e6 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c @@ -29,15 +29,15 @@ struct nvd0_gpio_priv {  };  static void -nvd0_gpio_reset(struct nouveau_gpio *gpio) +nvd0_gpio_reset(struct nouveau_gpio *gpio, u8 match)  {  	struct nouveau_bios *bios = nouveau_bios(gpio);  	struct nvd0_gpio_priv *priv = (void *)gpio; +	u8 ver, len;  	u16 entry; -	u8 ver;  	int ent = -1; -	while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver))) { +	while ((entry = dcb_gpio_entry(bios, 0, ++ent, &ver, &len))) {  		u32 data = nv_ro32(bios, entry);  		u8  line =   (data & 0x0000003f);  		u8  defs = !!(data & 0x00000080); @@ -45,7 +45,8 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)  		u8  unk0 =   (data & 0x00ff0000) >> 16;  		u8  unk1 =   (data & 0x1f000000) >> 24; -		if (func == 0xff) +		if ( func  == DCB_GPIO_UNUSED || +		    (match != DCB_GPIO_UNUSED && match != func))  			continue;  		gpio->set(gpio, 0, func, line, defs); diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c index 93e3ddf7303..e286e132c7e 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c @@ -260,7 +260,7 @@ nouveau_mxm_create_(struct nouveau_object *parent,  	data = mxm_table(bios, &ver, &len);  	if (!data || !(ver = nv_ro08(bios, data))) { -		nv_info(mxm, "no VBIOS data, nothing to do\n"); +		nv_debug(mxm, "no VBIOS data, nothing to do\n");  		return 0;  	} diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 74c6b42d259..7a445666e71 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c @@ -2654,6 +2654,35 @@ static int evergreen_packet3_check(struct radeon_cs_parser *p,  			ib[idx+4] = upper_32_bits(offset) & 0xff;  		}  		break; +	case PACKET3_MEM_WRITE: +	{ +		u64 offset; + +		if (pkt->count != 3) { +			DRM_ERROR("bad MEM_WRITE (invalid count)\n"); +			return -EINVAL; +		} +		r = evergreen_cs_packet_next_reloc(p, &reloc); +		if (r) { +			DRM_ERROR("bad MEM_WRITE (missing reloc)\n"); +			return -EINVAL; +		} +		offset = radeon_get_ib_value(p, idx+0); +		offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL; +		if (offset & 0x7) { +			DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n"); +			return -EINVAL; +		} +		if ((offset + 8) > radeon_bo_size(reloc->robj)) { +			DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n", +				  offset + 8, radeon_bo_size(reloc->robj)); +			return -EINVAL; +		} +		offset += reloc->lobj.gpu_offset; +		ib[idx+0] = offset; +		ib[idx+1] = upper_32_bits(offset) & 0xff; +		break; +	}  	case PACKET3_COPY_DW:  		if (pkt->count != 4) {  			DRM_ERROR("bad COPY_DW (invalid count)\n"); @@ -3287,6 +3316,7 @@ static bool evergreen_vm_reg_valid(u32 reg)  	/* check config regs */  	switch (reg) { +	case WAIT_UNTIL:  	case GRBM_GFX_INDEX:  	case CP_STRMOUT_CNTL:  	case CP_COHER_CNTL: diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 0be768be530..9ea13d07cc5 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c @@ -2294,6 +2294,35 @@ static int r600_packet3_check(struct radeon_cs_parser *p,  			ib[idx+4] = upper_32_bits(offset) & 0xff;  		}  		break; +	case PACKET3_MEM_WRITE: +	{ +		u64 offset; + +		if (pkt->count != 3) { +			DRM_ERROR("bad MEM_WRITE (invalid count)\n"); +			return -EINVAL; +		} +		r = r600_cs_packet_next_reloc(p, &reloc); +		if (r) { +			DRM_ERROR("bad MEM_WRITE (missing reloc)\n"); +			return -EINVAL; +		} +		offset = radeon_get_ib_value(p, idx+0); +		offset += ((u64)(radeon_get_ib_value(p, idx+1) & 0xff)) << 32UL; +		if (offset & 0x7) { +			DRM_ERROR("bad MEM_WRITE (address not qwords aligned)\n"); +			return -EINVAL; +		} +		if ((offset + 8) > radeon_bo_size(reloc->robj)) { +			DRM_ERROR("bad MEM_WRITE bo too small: 0x%llx, 0x%lx\n", +				  offset + 8, radeon_bo_size(reloc->robj)); +			return -EINVAL; +		} +		offset += reloc->lobj.gpu_offset; +		ib[idx+0] = offset; +		ib[idx+1] = upper_32_bits(offset) & 0xff; +		break; +	}  	case PACKET3_COPY_DW:  		if (pkt->count != 4) {  			DRM_ERROR("bad COPY_DW (invalid count)\n"); diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5dc744d43d1..9b9422c4403 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -225,12 +225,13 @@ struct radeon_fence {  int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);  int radeon_fence_driver_init(struct radeon_device *rdev);  void radeon_fence_driver_fini(struct radeon_device *rdev); +void radeon_fence_driver_force_completion(struct radeon_device *rdev);  int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring);  void radeon_fence_process(struct radeon_device *rdev, int ring);  bool radeon_fence_signaled(struct radeon_fence *fence);  int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);  int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring); -void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring); +int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);  int radeon_fence_wait_any(struct radeon_device *rdev,  			  struct radeon_fence **fences,  			  bool intr); diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 49b06590001..cd756262924 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1164,6 +1164,7 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)  	struct drm_crtc *crtc;  	struct drm_connector *connector;  	int i, r; +	bool force_completion = false;  	if (dev == NULL || dev->dev_private == NULL) {  		return -ENODEV; @@ -1206,8 +1207,16 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)  	mutex_lock(&rdev->ring_lock);  	/* wait for gpu to finish processing current batch */ -	for (i = 0; i < RADEON_NUM_RINGS; i++) -		radeon_fence_wait_empty_locked(rdev, i); +	for (i = 0; i < RADEON_NUM_RINGS; i++) { +		r = radeon_fence_wait_empty_locked(rdev, i); +		if (r) { +			/* delay GPU reset to resume */ +			force_completion = true; +		} +	} +	if (force_completion) { +		radeon_fence_driver_force_completion(rdev); +	}  	mutex_unlock(&rdev->ring_lock);  	radeon_save_bios_scratch_regs(rdev); @@ -1338,7 +1347,6 @@ retry:  	}  	radeon_restore_bios_scratch_regs(rdev); -	drm_helper_resume_force_mode(rdev->ddev);  	if (!r) {  		for (i = 0; i < RADEON_NUM_RINGS; ++i) { @@ -1358,11 +1366,14 @@ retry:  			}  		}  	} else { +		radeon_fence_driver_force_completion(rdev);  		for (i = 0; i < RADEON_NUM_RINGS; ++i) {  			kfree(ring_data[i]);  		}  	} +	drm_helper_resume_force_mode(rdev->ddev); +  	ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched);  	if (r) {  		/* bad news, how to tell it to userspace ? */ diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 9b1a727d3c9..ff7593498a7 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -68,9 +68,10 @@   *   2.25.0 - eg+: new info request for num SE and num SH   *   2.26.0 - r600-eg: fix htile size computation   *   2.27.0 - r600-SI: Add CS ioctl support for async DMA + *   2.28.0 - r600-eg: Add MEM_WRITE packet support   */  #define KMS_DRIVER_MAJOR	2 -#define KMS_DRIVER_MINOR	27 +#define KMS_DRIVER_MINOR	28  #define KMS_DRIVER_PATCHLEVEL	0  int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);  int radeon_driver_unload_kms(struct drm_device *dev); diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 410a975a8ee..34356252567 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -609,26 +609,20 @@ int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring)   * Returns 0 if the fences have passed, error for all other cases.   * Caller must hold ring lock.   */ -void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring) +int radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring)  {  	uint64_t seq = rdev->fence_drv[ring].sync_seq[ring]; +	int r; -	while(1) { -		int r; -		r = radeon_fence_wait_seq(rdev, seq, ring, false, false); +	r = radeon_fence_wait_seq(rdev, seq, ring, false, false); +	if (r) {  		if (r == -EDEADLK) { -			mutex_unlock(&rdev->ring_lock); -			r = radeon_gpu_reset(rdev); -			mutex_lock(&rdev->ring_lock); -			if (!r) -				continue; -		} -		if (r) { -			dev_err(rdev->dev, "error waiting for ring to become" -				" idle (%d)\n", r); +			return -EDEADLK;  		} -		return; +		dev_err(rdev->dev, "error waiting for ring[%d] to become idle (%d)\n", +			ring, r);  	} +	return 0;  }  /** @@ -854,13 +848,17 @@ int radeon_fence_driver_init(struct radeon_device *rdev)   */  void radeon_fence_driver_fini(struct radeon_device *rdev)  { -	int ring; +	int ring, r;  	mutex_lock(&rdev->ring_lock);  	for (ring = 0; ring < RADEON_NUM_RINGS; ring++) {  		if (!rdev->fence_drv[ring].initialized)  			continue; -		radeon_fence_wait_empty_locked(rdev, ring); +		r = radeon_fence_wait_empty_locked(rdev, ring); +		if (r) { +			/* no need to trigger GPU reset as we are unloading */ +			radeon_fence_driver_force_completion(rdev); +		}  		wake_up_all(&rdev->fence_queue);  		radeon_scratch_free(rdev, rdev->fence_drv[ring].scratch_reg);  		rdev->fence_drv[ring].initialized = false; @@ -868,6 +866,25 @@ void radeon_fence_driver_fini(struct radeon_device *rdev)  	mutex_unlock(&rdev->ring_lock);  } +/** + * radeon_fence_driver_force_completion - force all fence waiter to complete + * + * @rdev: radeon device pointer + * + * In case of GPU reset failure make sure no process keep waiting on fence + * that will never complete. + */ +void radeon_fence_driver_force_completion(struct radeon_device *rdev) +{ +	int ring; + +	for (ring = 0; ring < RADEON_NUM_RINGS; ring++) { +		if (!rdev->fence_drv[ring].initialized) +			continue; +		radeon_fence_write(rdev, rdev->fence_drv[ring].sync_seq[ring], ring); +	} +} +  /*   * Fence debugfs diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index aa14dbb7e4f..0bfa656aa87 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c @@ -234,7 +234,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)  static void radeon_pm_set_clocks(struct radeon_device *rdev)  { -	int i; +	int i, r;  	/* no need to take locks, etc. if nothing's going to change */  	if ((rdev->pm.requested_clock_mode_index == rdev->pm.current_clock_mode_index) && @@ -248,8 +248,17 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)  	/* wait for the rings to drain */  	for (i = 0; i < RADEON_NUM_RINGS; i++) {  		struct radeon_ring *ring = &rdev->ring[i]; -		if (ring->ready) -			radeon_fence_wait_empty_locked(rdev, i); +		if (!ring->ready) { +			continue; +		} +		r = radeon_fence_wait_empty_locked(rdev, i); +		if (r) { +			/* needs a GPU reset dont reset here */ +			mutex_unlock(&rdev->ring_lock); +			up_write(&rdev->pm.mclk_lock); +			mutex_unlock(&rdev->ddev->struct_mutex); +			return; +		}  	}  	radeon_unmap_vram_bos(rdev); diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 074410371e2..656b2e3334a 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -102,12 +102,12 @@ static int tegra_dc_set_timings(struct tegra_dc *dc,  		((mode->hsync_end - mode->hsync_start) <<  0);  	tegra_dc_writel(dc, value, DC_DISP_SYNC_WIDTH); -	value = ((mode->vsync_start - mode->vdisplay) << 16) | -		((mode->hsync_start - mode->hdisplay) <<  0); -	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH); -  	value = ((mode->vtotal - mode->vsync_end) << 16) |  		((mode->htotal - mode->hsync_end) <<  0); +	tegra_dc_writel(dc, value, DC_DISP_BACK_PORCH); + +	value = ((mode->vsync_start - mode->vdisplay) << 16) | +		((mode->hsync_start - mode->hdisplay) <<  0);  	tegra_dc_writel(dc, value, DC_DISP_FRONT_PORCH);  	value = (mode->vdisplay << 16) | mode->hdisplay; @@ -221,8 +221,7 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc,  	win.stride = crtc->fb->pitches[0];  	/* program window registers */ -	value = tegra_dc_readl(dc, DC_CMD_DISPLAY_WINDOW_HEADER); -	value |= WINDOW_A_SELECT; +	value = WINDOW_A_SELECT;  	tegra_dc_writel(dc, value, DC_CMD_DISPLAY_WINDOW_HEADER);  	tegra_dc_writel(dc, win.fmt, DC_WIN_COLOR_DEPTH); diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 3a843a77ddc..741b5dc2742 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -204,24 +204,6 @@ extern int tegra_output_parse_dt(struct tegra_output *output);  extern int tegra_output_init(struct drm_device *drm, struct tegra_output *output);  extern int tegra_output_exit(struct tegra_output *output); -/* from gem.c */ -extern struct tegra_gem_object *tegra_gem_alloc(struct drm_device *drm, -						size_t size); -extern int tegra_gem_handle_create(struct drm_device *drm, -				   struct drm_file *file, size_t size, -				   unsigned long flags, uint32_t *handle); -extern int tegra_gem_dumb_create(struct drm_file *file, struct drm_device *drm, -				 struct drm_mode_create_dumb *args); -extern int tegra_gem_dumb_map_offset(struct drm_file *file, -				     struct drm_device *drm, uint32_t handle, -				     uint64_t *offset); -extern int tegra_gem_dumb_destroy(struct drm_file *file, -				  struct drm_device *drm, uint32_t handle); -extern int tegra_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); -extern int tegra_gem_init_object(struct drm_gem_object *obj); -extern void tegra_gem_free_object(struct drm_gem_object *obj); -extern struct vm_operations_struct tegra_gem_vm_ops; -  /* from fb.c */  extern int tegra_drm_fb_init(struct drm_device *drm);  extern void tegra_drm_fb_exit(struct drm_device *drm); diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index ab4016412bb..e060c7e6434 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -149,7 +149,7 @@ struct tmds_config {  };  static const struct tmds_config tegra2_tmds_config[] = { -	{ /* 480p modes */ +	{ /* slow pixel clock modes */  		.pclk = 27000000,  		.pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |  			SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(0) | @@ -163,21 +163,8 @@ static const struct tmds_config tegra2_tmds_config[] = {  			DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) |  			DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) |  			DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA), -	}, { /* 720p modes */ -		.pclk = 74250000, -		.pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) | -			SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) | -			SOR_PLL_TX_REG_LOAD(3), -		.pll1 = SOR_PLL_TMDS_TERM_ENABLE | SOR_PLL_PE_EN, -		.pe_current = PE_CURRENT0(PE_CURRENT_6_0_mA) | -			PE_CURRENT1(PE_CURRENT_6_0_mA) | -			PE_CURRENT2(PE_CURRENT_6_0_mA) | -			PE_CURRENT3(PE_CURRENT_6_0_mA), -		.drive_current = DRIVE_CURRENT_LANE0(DRIVE_CURRENT_7_125_mA) | -			DRIVE_CURRENT_LANE1(DRIVE_CURRENT_7_125_mA) | -			DRIVE_CURRENT_LANE2(DRIVE_CURRENT_7_125_mA) | -			DRIVE_CURRENT_LANE3(DRIVE_CURRENT_7_125_mA), -	}, { /* 1080p modes */ +	}, +	{ /* high pixel clock modes */  		.pclk = UINT_MAX,  		.pll0 = SOR_PLL_BG_V17_S(3) | SOR_PLL_ICHPMP(1) |  			SOR_PLL_RESISTORSEL | SOR_PLL_VCOCAP(1) | @@ -479,7 +466,7 @@ static void tegra_hdmi_setup_avi_infoframe(struct tegra_hdmi *hdmi,  		return;  	} -	h_front_porch = mode->htotal - mode->hsync_end; +	h_front_porch = mode->hsync_start - mode->hdisplay;  	memset(&frame, 0, sizeof(frame));  	frame.r = HDMI_AVI_R_SAME; @@ -634,8 +621,8 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)  	pclk = mode->clock * 1000;  	h_sync_width = mode->hsync_end - mode->hsync_start; -	h_front_porch = mode->htotal - mode->hsync_end; -	h_back_porch = mode->hsync_start - mode->hdisplay; +	h_back_porch = mode->htotal - mode->hsync_end; +	h_front_porch = mode->hsync_start - mode->hdisplay;  	err = regulator_enable(hdmi->vdd);  	if (err < 0) { diff --git a/drivers/gpu/drm/tegra/host1x.c b/drivers/gpu/drm/tegra/host1x.c index bdb97a564d8..5d17b113a6f 100644 --- a/drivers/gpu/drm/tegra/host1x.c +++ b/drivers/gpu/drm/tegra/host1x.c @@ -239,6 +239,8 @@ int host1x_register_client(struct host1x *host1x, struct host1x_client *client)  		}  	} +	client->host1x = host1x; +  	return 0;  } diff --git a/drivers/hwmon/emc6w201.c b/drivers/hwmon/emc6w201.c index a98c917b588..789bd4fb329 100644 --- a/drivers/hwmon/emc6w201.c +++ b/drivers/hwmon/emc6w201.c @@ -187,7 +187,7 @@ static struct emc6w201_data *emc6w201_update_device(struct device *dev)   * Sysfs callback functions   */ -static const u16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 }; +static const s16 nominal_mv[6] = { 2500, 1500, 3300, 5000, 1500, 1500 };  static ssize_t show_in(struct device *dev, struct device_attribute *devattr,  	char *buf) diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c index 8fa2632cbba..7272176a9ec 100644 --- a/drivers/hwmon/lm73.c +++ b/drivers/hwmon/lm73.c @@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,  	struct i2c_client *client = to_i2c_client(dev);  	long temp;  	short value; +	s32 err;  	int status = kstrtol(buf, 10, &temp);  	if (status < 0) @@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,  	/* Write value */  	value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4),  		(LM73_TEMP_MAX*4)) << 5; -	i2c_smbus_write_word_swapped(client, attr->index, value); -	return count; +	err = i2c_smbus_write_word_swapped(client, attr->index, value); +	return (err < 0) ? err : count;  }  static ssize_t show_temp(struct device *dev, struct device_attribute *da, @@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,  {  	struct sensor_device_attribute *attr = to_sensor_dev_attr(da);  	struct i2c_client *client = to_i2c_client(dev); +	int temp; + +	s32 err = i2c_smbus_read_word_swapped(client, attr->index); +	if (err < 0) +		return err; +  	/* use integer division instead of equivalent right shift to  	   guarantee arithmetic shift and preserve the sign */ -	int temp = ((s16) (i2c_smbus_read_word_swapped(client, -		    attr->index))*250) / 32; -	return sprintf(buf, "%d\n", temp); +	temp = (((s16) err) * 250) / 32; +	return scnprintf(buf, PAGE_SIZE, "%d\n", temp);  } diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index 125cd8e0ad2..3f491815e2c 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c @@ -139,7 +139,7 @@ static unsigned short ali1535_offset;     Note the differences between kernels with the old PCI BIOS interface and     newer kernels with the real PCI interface. In compat.h some things are     defined to make the transition easier. */ -static int __devinit ali1535_setup(struct pci_dev *dev) +static int ali1535_setup(struct pci_dev *dev)  {  	int retval;  	unsigned char temp; @@ -502,7 +502,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali1535_ids) = {  MODULE_DEVICE_TABLE(pci, ali1535_ids); -static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int ali1535_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	if (ali1535_setup(dev)) {  		dev_warn(&dev->dev, @@ -518,7 +518,7 @@ static int __devinit ali1535_probe(struct pci_dev *dev, const struct pci_device_  	return i2c_add_adapter(&ali1535_adapter);  } -static void __devexit ali1535_remove(struct pci_dev *dev) +static void ali1535_remove(struct pci_dev *dev)  {  	i2c_del_adapter(&ali1535_adapter);  	release_region(ali1535_smba, ALI1535_SMB_IOSIZE); @@ -528,7 +528,7 @@ static struct pci_driver ali1535_driver = {  	.name		= "ali1535_smbus",  	.id_table	= ali1535_ids,  	.probe		= ali1535_probe, -	.remove		= __devexit_p(ali1535_remove), +	.remove		= ali1535_remove,  };  module_pci_driver(ali1535_driver); diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index e02d9f86c6a..84ccd9496a5 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c @@ -326,7 +326,7 @@ static u32 ali1563_func(struct i2c_adapter * a)  } -static int __devinit ali1563_setup(struct pci_dev * dev) +static int ali1563_setup(struct pci_dev *dev)  {  	u16 ctrl; @@ -390,8 +390,8 @@ static struct i2c_adapter ali1563_adapter = {  	.algo	= &ali1563_algorithm,  }; -static int __devinit ali1563_probe(struct pci_dev * dev, -				const struct pci_device_id * id_table) +static int ali1563_probe(struct pci_dev *dev, +			 const struct pci_device_id *id_table)  {  	int error; @@ -411,7 +411,7 @@ exit:  	return error;  } -static void __devexit ali1563_remove(struct pci_dev * dev) +static void ali1563_remove(struct pci_dev *dev)  {  	i2c_del_adapter(&ali1563_adapter);  	ali1563_shutdown(dev); @@ -428,7 +428,7 @@ static struct pci_driver ali1563_pci_driver = {   	.name		= "ali1563_smbus",  	.id_table	= ali1563_id_table,   	.probe		= ali1563_probe, -	.remove		= __devexit_p(ali1563_remove), +	.remove		= ali1563_remove,  };  module_pci_driver(ali1563_pci_driver); diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index ce8d26d053a..26bcc6127ce 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c @@ -131,7 +131,7 @@ MODULE_PARM_DESC(force_addr,  static struct pci_driver ali15x3_driver;  static unsigned short ali15x3_smba; -static int __devinit ali15x3_setup(struct pci_dev *ALI15X3_dev) +static int ali15x3_setup(struct pci_dev *ALI15X3_dev)  {  	u16 a;  	unsigned char temp; @@ -484,7 +484,7 @@ static DEFINE_PCI_DEVICE_TABLE(ali15x3_ids) = {  MODULE_DEVICE_TABLE (pci, ali15x3_ids); -static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	if (ali15x3_setup(dev)) {  		dev_err(&dev->dev, @@ -500,7 +500,7 @@ static int __devinit ali15x3_probe(struct pci_dev *dev, const struct pci_device_  	return i2c_add_adapter(&ali15x3_adapter);  } -static void __devexit ali15x3_remove(struct pci_dev *dev) +static void ali15x3_remove(struct pci_dev *dev)  {  	i2c_del_adapter(&ali15x3_adapter);  	release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); @@ -510,7 +510,7 @@ static struct pci_driver ali15x3_driver = {  	.name		= "ali15x3_smbus",  	.id_table	= ali15x3_ids,  	.probe		= ali15x3_probe, -	.remove		= __devexit_p(ali15x3_remove), +	.remove		= ali15x3_remove,  };  module_pci_driver(ali15x3_driver); diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 304aa03b57b..e13e2aa2d05 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c @@ -324,8 +324,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd756_ids) = {  MODULE_DEVICE_TABLE (pci, amd756_ids); -static int __devinit amd756_probe(struct pci_dev *pdev, -				  const struct pci_device_id *id) +static int amd756_probe(struct pci_dev *pdev, const struct pci_device_id *id)  {  	int nforce = (id->driver_data == NFORCE);  	int error; @@ -397,7 +396,7 @@ static int __devinit amd756_probe(struct pci_dev *pdev,  	return error;  } -static void __devexit amd756_remove(struct pci_dev *dev) +static void amd756_remove(struct pci_dev *dev)  {  	i2c_del_adapter(&amd756_smbus);  	release_region(amd756_ioport, SMB_IOSIZE); @@ -407,7 +406,7 @@ static struct pci_driver amd756_driver = {  	.name		= "amd756_smbus",  	.id_table	= amd756_ids,  	.probe		= amd756_probe, -	.remove		= __devexit_p(amd756_remove), +	.remove		= amd756_remove,  };  module_pci_driver(amd756_driver); diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 0919ac1d99a..a44e6e77c5a 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c @@ -422,8 +422,7 @@ static DEFINE_PCI_DEVICE_TABLE(amd8111_ids) = {  MODULE_DEVICE_TABLE (pci, amd8111_ids); -static int __devinit amd8111_probe(struct pci_dev *dev, -		const struct pci_device_id *id) +static int amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	struct amd_smbus *smbus;  	int error; @@ -475,7 +474,7 @@ static int __devinit amd8111_probe(struct pci_dev *dev,  	return error;  } -static void __devexit amd8111_remove(struct pci_dev *dev) +static void amd8111_remove(struct pci_dev *dev)  {  	struct amd_smbus *smbus = pci_get_drvdata(dev); @@ -488,7 +487,7 @@ static struct pci_driver amd8111_driver = {  	.name		= "amd8111_smbus2",  	.id_table	= amd8111_ids,  	.probe		= amd8111_probe, -	.remove		= __devexit_p(amd8111_remove), +	.remove		= amd8111_remove,  };  module_pci_driver(amd8111_driver); diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index b4575ee4bdf..2bfc04d0a1b 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -145,7 +145,7 @@ static void at91_init_twi_bus(struct at91_twi_dev *dev)   * Calculate symmetric clock as stated in datasheet:   * twi_clk = F_MAIN / (2 * (cdiv * (1 << ckdiv) + offset))   */ -static void __devinit at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk) +static void at91_calc_twi_clock(struct at91_twi_dev *dev, int twi_clk)  {  	int ckdiv, cdiv, div;  	struct at91_twi_pdata *pdata = dev->pdata; @@ -604,7 +604,7 @@ MODULE_DEVICE_TABLE(of, atmel_twi_dt_ids);  #define atmel_twi_dt_ids NULL  #endif -static bool __devinit filter(struct dma_chan *chan, void *slave) +static bool filter(struct dma_chan *chan, void *slave)  {  	struct at_dma_slave *sl = slave; @@ -616,7 +616,7 @@ static bool __devinit filter(struct dma_chan *chan, void *slave)  	}  } -static int __devinit at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) +static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr)  {  	int ret = 0;  	struct at_dma_slave *sdata; @@ -688,7 +688,7 @@ error:  	return ret;  } -static struct at91_twi_pdata * __devinit at91_twi_get_driver_data( +static struct at91_twi_pdata *at91_twi_get_driver_data(  					struct platform_device *pdev)  {  	if (pdev->dev.of_node) { @@ -701,7 +701,7 @@ static struct at91_twi_pdata * __devinit at91_twi_get_driver_data(  	return (struct at91_twi_pdata *) platform_get_device_id(pdev)->driver_data;  } -static int __devinit at91_twi_probe(struct platform_device *pdev) +static int at91_twi_probe(struct platform_device *pdev)  {  	struct at91_twi_dev *dev;  	struct resource *mem; @@ -779,7 +779,7 @@ static int __devinit at91_twi_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit at91_twi_remove(struct platform_device *pdev) +static int at91_twi_remove(struct platform_device *pdev)  {  	struct at91_twi_dev *dev = platform_get_drvdata(pdev);  	int rc; @@ -820,7 +820,7 @@ static const struct dev_pm_ops at91_twi_pm = {  static struct platform_driver at91_twi_driver = {  	.probe		= at91_twi_probe, -	.remove		= __devexit_p(at91_twi_remove), +	.remove		= at91_twi_remove,  	.id_table	= at91_twi_devtypes,  	.driver		= {  		.name	= "at91_i2c", diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index 582d616db34..b278298787d 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c @@ -313,7 +313,7 @@ static void i2c_au1550_disable(struct i2c_au1550_data *priv)   * Prior to calling us, the 50MHz clock frequency and routing   * must have been set up for the PSC indicated by the adapter.   */ -static int __devinit +static int  i2c_au1550_probe(struct platform_device *pdev)  {  	struct i2c_au1550_data *priv; @@ -372,7 +372,7 @@ out:  	return ret;  } -static int __devexit i2c_au1550_remove(struct platform_device *pdev) +static int i2c_au1550_remove(struct platform_device *pdev)  {  	struct i2c_au1550_data *priv = platform_get_drvdata(pdev); @@ -423,7 +423,7 @@ static struct platform_driver au1xpsc_smbus_driver = {  		.pm	= AU1XPSC_SMBUS_PMOPS,  	},  	.probe		= i2c_au1550_probe, -	.remove		= __devexit_p(i2c_au1550_remove), +	.remove		= i2c_au1550_remove,  };  module_platform_driver(au1xpsc_smbus_driver); diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index c1e1096ba06..2e79c102419 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c @@ -426,7 +426,7 @@ static const struct i2c_adapter cpm_ops = {  	.algo		= &cpm_i2c_algo,  }; -static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) +static int cpm_i2c_setup(struct cpm_i2c *cpm)  {  	struct platform_device *ofdev = cpm->ofdev;  	const u32 *data; @@ -634,7 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)  		cpm_muram_free(cpm->i2c_addr);  } -static int __devinit cpm_i2c_probe(struct platform_device *ofdev) +static int cpm_i2c_probe(struct platform_device *ofdev)  {  	int result, len;  	struct cpm_i2c *cpm; @@ -688,7 +688,7 @@ out_free:  	return result;  } -static int __devexit cpm_i2c_remove(struct platform_device *ofdev) +static int cpm_i2c_remove(struct platform_device *ofdev)  {  	struct cpm_i2c *cpm = dev_get_drvdata(&ofdev->dev); @@ -716,7 +716,7 @@ MODULE_DEVICE_TABLE(of, cpm_i2c_match);  static struct platform_driver cpm_i2c_driver = {  	.probe		= cpm_i2c_probe, -	.remove		= __devexit_p(cpm_i2c_remove), +	.remove		= cpm_i2c_remove,  	.driver = {  		.name = "fsl-i2c-cpm",  		.owner = THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 92a1e2c15ba..6add851e9de 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -207,7 +207,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)  	return dev->controller->clk_khz;  } -static int __devinit i2c_dw_pci_probe(struct pci_dev *pdev, +static int i2c_dw_pci_probe(struct pci_dev *pdev,  const struct pci_device_id *id)  {  	struct dw_i2c_dev *dev; @@ -328,7 +328,7 @@ exit:  	return r;  } -static void __devexit i2c_dw_pci_remove(struct pci_dev *pdev) +static void i2c_dw_pci_remove(struct pci_dev *pdev)  {  	struct dw_i2c_dev *dev = pci_get_drvdata(pdev); @@ -368,7 +368,7 @@ static struct pci_driver dw_i2c_driver = {  	.name		= DRIVER_NAME,  	.id_table	= i2_designware_pci_ids,  	.probe		= i2c_dw_pci_probe, -	.remove		= __devexit_p(i2c_dw_pci_remove), +	.remove		= i2c_dw_pci_remove,  	.driver         = {  		.pm     = &i2c_dw_pm_ops,  	}, diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 0506fef8dc0..343357a2b5b 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -50,7 +50,7 @@ static u32 i2c_dw_get_clk_rate_khz(struct dw_i2c_dev *dev)  	return clk_get_rate(dev->clk)/1000;  } -static int __devinit dw_i2c_probe(struct platform_device *pdev) +static int dw_i2c_probe(struct platform_device *pdev)  {  	struct dw_i2c_dev *dev;  	struct i2c_adapter *adap; @@ -169,7 +169,7 @@ err_release_region:  	return r;  } -static int __devexit dw_i2c_remove(struct platform_device *pdev) +static int dw_i2c_remove(struct platform_device *pdev)  {  	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);  	struct resource *mem; @@ -228,7 +228,7 @@ static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);  MODULE_ALIAS("platform:i2c_designware");  static struct platform_driver dw_i2c_driver = { -	.remove		= __devexit_p(dw_i2c_remove), +	.remove		= dw_i2c_remove,  	.driver		= {  		.name	= "i2c_designware",  		.owner	= THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 259f7697bf2..5e7886e7136 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c @@ -758,7 +758,7 @@ static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap)  	iowrite32(BUFFER_MODE_INTR_DISBL, p + PCH_I2CBUFMSK);  } -static int __devinit pch_i2c_probe(struct pci_dev *pdev, +static int pch_i2c_probe(struct pci_dev *pdev,  				   const struct pci_device_id *id)  {  	void __iomem *base_addr; @@ -851,7 +851,7 @@ err_pci_enable:  	return ret;  } -static void __devexit pch_i2c_remove(struct pci_dev *pdev) +static void pch_i2c_remove(struct pci_dev *pdev)  {  	int i;  	struct adapter_info *adap_info = pci_get_drvdata(pdev); @@ -948,7 +948,7 @@ static struct pci_driver pch_pcidriver = {  	.name = KBUILD_MODNAME,  	.id_table = pch_pcidev_id,  	.probe = pch_i2c_probe, -	.remove = __devexit_p(pch_i2c_remove), +	.remove = pch_i2c_remove,  	.suspend = pch_i2c_suspend,  	.resume = pch_i2c_resume  }; diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index 37e2e82a9c8..485497066ed 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c @@ -205,7 +205,7 @@ static struct i2c_adapter pcf_isa_ops = {  	.name		= "i2c-elektor",  }; -static int __devinit elektor_match(struct device *dev, unsigned int id) +static int elektor_match(struct device *dev, unsigned int id)  {  #ifdef __alpha__  	/* check to see we have memory mapped PCF8584 connected to the @@ -264,7 +264,7 @@ static int __devinit elektor_match(struct device *dev, unsigned int id)  	return 1;  } -static int __devinit elektor_probe(struct device *dev, unsigned int id) +static int elektor_probe(struct device *dev, unsigned int id)  {  	init_waitqueue_head(&pcf_wait);  	if (pcf_isa_init()) @@ -293,7 +293,7 @@ static int __devinit elektor_probe(struct device *dev, unsigned int id)  	return -ENODEV;  } -static int __devexit elektor_remove(struct device *dev, unsigned int id) +static int elektor_remove(struct device *dev, unsigned int id)  {  	i2c_del_adapter(&pcf_isa_ops); @@ -316,7 +316,7 @@ static int __devexit elektor_remove(struct device *dev, unsigned int id)  static struct isa_driver i2c_elektor_driver = {  	.match		= elektor_match,  	.probe		= elektor_probe, -	.remove		= __devexit_p(elektor_remove), +	.remove		= elektor_remove,  	.driver = {  		.owner	= THIS_MODULE,  		.name	= "i2c-elektor", diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index 257299a92df..f3fa4332bbd 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -85,7 +85,7 @@ static int i2c_gpio_getscl(void *data)  	return gpio_get_value(pdata->scl_pin);  } -static int __devinit of_i2c_gpio_probe(struct device_node *np, +static int of_i2c_gpio_probe(struct device_node *np,  			     struct i2c_gpio_platform_data *pdata)  {  	u32 reg; @@ -117,7 +117,7 @@ static int __devinit of_i2c_gpio_probe(struct device_node *np,  	return 0;  } -static int __devinit i2c_gpio_probe(struct platform_device *pdev) +static int i2c_gpio_probe(struct platform_device *pdev)  {  	struct i2c_gpio_private_data *priv;  	struct i2c_gpio_platform_data *pdata; @@ -218,7 +218,7 @@ err_request_sda:  	return ret;  } -static int __devexit i2c_gpio_remove(struct platform_device *pdev) +static int i2c_gpio_remove(struct platform_device *pdev)  {  	struct i2c_gpio_private_data *priv;  	struct i2c_gpio_platform_data *pdata; @@ -251,7 +251,7 @@ static struct platform_driver i2c_gpio_driver = {  		.of_match_table	= of_match_ptr(i2c_gpio_dt_ids),  	},  	.probe		= i2c_gpio_probe, -	.remove		= __devexit_p(i2c_gpio_remove), +	.remove		= i2c_gpio_remove,  };  static int __init i2c_gpio_init(void) diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c index 19515df6102..3351cc7ed11 100644 --- a/drivers/i2c/busses/i2c-highlander.c +++ b/drivers/i2c/busses/i2c-highlander.c @@ -356,7 +356,7 @@ static const struct i2c_algorithm highlander_i2c_algo = {  	.functionality	= highlander_i2c_func,  }; -static int __devinit highlander_i2c_probe(struct platform_device *pdev) +static int highlander_i2c_probe(struct platform_device *pdev)  {  	struct highlander_i2c_dev *dev;  	struct i2c_adapter *adap; @@ -441,7 +441,7 @@ err:  	return ret;  } -static int __devexit highlander_i2c_remove(struct platform_device *pdev) +static int highlander_i2c_remove(struct platform_device *pdev)  {  	struct highlander_i2c_dev *dev = platform_get_drvdata(pdev); @@ -465,7 +465,7 @@ static struct platform_driver highlander_i2c_driver = {  	},  	.probe		= highlander_i2c_probe, -	.remove		= __devexit_p(highlander_i2c_remove), +	.remove		= highlander_i2c_remove,  };  module_platform_driver(highlander_i2c_driver); diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index c9f95e1666a..79c3d9069a4 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c @@ -112,7 +112,7 @@ static DEFINE_PCI_DEVICE_TABLE(hydra_ids) = {  MODULE_DEVICE_TABLE (pci, hydra_ids); -static int __devinit hydra_probe(struct pci_dev *dev, +static int hydra_probe(struct pci_dev *dev,  				 const struct pci_device_id *id)  {  	unsigned long base = pci_resource_start(dev, 0); @@ -139,7 +139,7 @@ static int __devinit hydra_probe(struct pci_dev *dev,  	return 0;  } -static void __devexit hydra_remove(struct pci_dev *dev) +static void hydra_remove(struct pci_dev *dev)  {  	pdregw(hydra_bit_data.data, 0);		/* clear SCLK_OE and SDAT_OE */  	i2c_del_adapter(&hydra_adap); @@ -153,7 +153,7 @@ static struct pci_driver hydra_driver = {  	.name		= "hydra_smbus",  	.id_table	= hydra_ids,  	.probe		= hydra_probe, -	.remove		= __devexit_p(hydra_remove), +	.remove		= hydra_remove,  };  module_pci_driver(hydra_driver); diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 1e73638225e..3092387f6ef 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -841,14 +841,14 @@ struct dmi_onboard_device_info {  	const char *i2c_type;  }; -static struct dmi_onboard_device_info __devinitdata dmi_devices[] = { +static const struct dmi_onboard_device_info dmi_devices[] = {  	{ "Syleus", DMI_DEV_TYPE_OTHER, 0x73, "fscsyl" },  	{ "Hermes", DMI_DEV_TYPE_OTHER, 0x73, "fscher" },  	{ "Hades",  DMI_DEV_TYPE_OTHER, 0x73, "fschds" },  }; -static void __devinit dmi_check_onboard_device(u8 type, const char *name, -					       struct i2c_adapter *adap) +static void dmi_check_onboard_device(u8 type, const char *name, +				     struct i2c_adapter *adap)  {  	int i;  	struct i2c_board_info info; @@ -871,8 +871,7 @@ static void __devinit dmi_check_onboard_device(u8 type, const char *name,  /* We use our own function to check for onboard devices instead of     dmi_find_device() as some buggy BIOS's have the devices we are interested     in marked as disabled */ -static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm, -						void *adap) +static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)  {  	int i, count; @@ -901,7 +900,7 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,  }  /* Register optional slaves */ -static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) +static void i801_probe_optional_slaves(struct i801_priv *priv)  {  	/* Only register slaves on main SMBus channel */  	if (priv->features & FEATURE_IDF) @@ -921,7 +920,7 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)  }  #else  static void __init input_apanel_init(void) {} -static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} +static void i801_probe_optional_slaves(struct i801_priv *priv) {}  #endif	/* CONFIG_X86 && CONFIG_DMI */  #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ @@ -944,7 +943,7 @@ static struct i801_mux_config i801_mux_config_asus_z8_d18 = {  	.n_gpios = 2,  }; -static struct dmi_system_id __devinitdata mux_dmi_table[] = { +static const struct dmi_system_id mux_dmi_table[] = {  	{  		.matches = {  			DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), @@ -1012,7 +1011,7 @@ static struct dmi_system_id __devinitdata mux_dmi_table[] = {  };  /* Setup multiplexing if needed */ -static int __devinit i801_add_mux(struct i801_priv *priv) +static int i801_add_mux(struct i801_priv *priv)  {  	struct device *dev = &priv->adapter.dev;  	const struct i801_mux_config *mux_config; @@ -1048,13 +1047,13 @@ static int __devinit i801_add_mux(struct i801_priv *priv)  	return 0;  } -static void __devexit i801_del_mux(struct i801_priv *priv) +static void i801_del_mux(struct i801_priv *priv)  {  	if (priv->mux_pdev)  		platform_device_unregister(priv->mux_pdev);  } -static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) +static unsigned int i801_get_adapter_class(struct i801_priv *priv)  {  	const struct dmi_system_id *id;  	const struct i801_mux_config *mux_config; @@ -1084,8 +1083,7 @@ static inline unsigned int i801_get_adapter_class(struct i801_priv *priv)  }  #endif -static int __devinit i801_probe(struct pci_dev *dev, -				const struct pci_device_id *id) +static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	unsigned char temp;  	int err, i; @@ -1226,7 +1224,7 @@ exit:  	return err;  } -static void __devexit i801_remove(struct pci_dev *dev) +static void i801_remove(struct pci_dev *dev)  {  	struct i801_priv *priv = pci_get_drvdata(dev); @@ -1272,7 +1270,7 @@ static struct pci_driver i801_driver = {  	.name		= "i801_smbus",  	.id_table	= i801_ids,  	.probe		= i801_probe, -	.remove		= __devexit_p(i801_remove), +	.remove		= i801_remove,  	.suspend	= i801_suspend,  	.resume		= i801_resume,  }; diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 806e225f3de..33a2abb6c06 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c @@ -660,7 +660,7 @@ static inline u8 iic_clckdiv(unsigned int opb)  	return (u8)((opb + 9) / 10 - 1);  } -static int __devinit iic_request_irq(struct platform_device *ofdev, +static int iic_request_irq(struct platform_device *ofdev,  				     struct ibm_iic_private *dev)  {  	struct device_node *np = ofdev->dev.of_node; @@ -691,7 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,  /*   * Register single IIC interface   */ -static int __devinit iic_probe(struct platform_device *ofdev) +static int iic_probe(struct platform_device *ofdev)  {  	struct device_node *np = ofdev->dev.of_node;  	struct ibm_iic_private *dev; @@ -781,7 +781,7 @@ error_cleanup:  /*   * Cleanup initialized IIC interface   */ -static int __devexit iic_remove(struct platform_device *ofdev) +static int iic_remove(struct platform_device *ofdev)  {  	struct ibm_iic_private *dev = dev_get_drvdata(&ofdev->dev); @@ -812,7 +812,7 @@ static struct platform_driver ibm_iic_driver = {  		.of_match_table = ibm_iic_match,  	},  	.probe	= iic_probe, -	.remove	= __devexit_p(iic_remove), +	.remove	= iic_remove,  };  module_platform_driver(ibm_iic_driver); diff --git a/drivers/i2c/busses/i2c-intel-mid.c b/drivers/i2c/busses/i2c-intel-mid.c index 7c28f10f95c..de3736bf646 100644 --- a/drivers/i2c/busses/i2c-intel-mid.c +++ b/drivers/i2c/busses/i2c-intel-mid.c @@ -947,7 +947,7 @@ static const struct dev_pm_ops intel_mid_i2c_pm_ops = {   * 5. Call intel_mid_i2c_hwinit() for hardware initialization   * 6. Register I2C adapter in i2c-core   */ -static int __devinit intel_mid_i2c_probe(struct pci_dev *dev, +static int intel_mid_i2c_probe(struct pci_dev *dev,  				    const struct pci_device_id *id)  {  	struct intel_mid_i2c_private *mrst; @@ -1079,7 +1079,7 @@ exit:  	return err;  } -static void __devexit intel_mid_i2c_remove(struct pci_dev *dev) +static void intel_mid_i2c_remove(struct pci_dev *dev)  {  	struct intel_mid_i2c_private *mrst = pci_get_drvdata(dev);  	intel_mid_i2c_disable(&mrst->adap); @@ -1113,7 +1113,7 @@ static struct pci_driver intel_mid_i2c_driver = {  	.name		= DRIVER_NAME,  	.id_table	= intel_mid_i2c_ids,  	.probe		= intel_mid_i2c_probe, -	.remove		= __devexit_p(intel_mid_i2c_remove), +	.remove		= intel_mid_i2c_remove,  };  module_pci_driver(intel_mid_i2c_driver); diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c index f90a6057508..4099f79c228 100644 --- a/drivers/i2c/busses/i2c-isch.c +++ b/drivers/i2c/busses/i2c-isch.c @@ -249,7 +249,7 @@ static struct i2c_adapter sch_adapter = {  	.algo		= &smbus_algorithm,  }; -static int __devinit smbus_sch_probe(struct platform_device *dev) +static int smbus_sch_probe(struct platform_device *dev)  {  	struct resource *res;  	int retval; @@ -284,7 +284,7 @@ static int __devinit smbus_sch_probe(struct platform_device *dev)  	return retval;  } -static int __devexit smbus_sch_remove(struct platform_device *pdev) +static int smbus_sch_remove(struct platform_device *pdev)  {  	struct resource *res;  	if (sch_smba) { @@ -303,7 +303,7 @@ static struct platform_driver smbus_sch_driver = {  		.owner = THIS_MODULE,  	},  	.probe		= smbus_sch_probe, -	.remove		= __devexit_p(smbus_sch_remove), +	.remove		= smbus_sch_remove,  };  module_platform_driver(smbus_sch_driver); diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index ca86430cb4a..a69459e5c3f 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c @@ -175,7 +175,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)  }  #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x) -static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = { +static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {  	{20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},  	{28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02},  	{36, 0x26}, {40, 0x27}, {44, 0x04}, {48, 0x28}, @@ -196,7 +196,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] __devinitconst = {  	{10240, 0x9d}, {12288, 0x9e}, {15360, 0x9f}  }; -static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, +static int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,  					  int prescaler, u32 *real_clk)  {  	const struct mpc_i2c_divider *div = NULL; @@ -230,7 +230,7 @@ static int __devinit mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock,  	return (int)div->fdr;  } -static void __devinit mpc_i2c_setup_52xx(struct device_node *node, +static void mpc_i2c_setup_52xx(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -252,7 +252,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,  			 fdr);  }  #else /* !(CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x) */ -static void __devinit mpc_i2c_setup_52xx(struct device_node *node, +static void mpc_i2c_setup_52xx(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -260,7 +260,7 @@ static void __devinit mpc_i2c_setup_52xx(struct device_node *node,  #endif /* CONFIG_PPC_MPC52xx || CONFIG_PPC_MPC512x */  #ifdef CONFIG_PPC_MPC512x -static void __devinit mpc_i2c_setup_512x(struct device_node *node, +static void mpc_i2c_setup_512x(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -288,7 +288,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,  	mpc_i2c_setup_52xx(node, i2c, clock, prescaler);  }  #else /* CONFIG_PPC_MPC512x */ -static void __devinit mpc_i2c_setup_512x(struct device_node *node, +static void mpc_i2c_setup_512x(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -296,7 +296,7 @@ static void __devinit mpc_i2c_setup_512x(struct device_node *node,  #endif /* CONFIG_PPC_MPC512x */  #ifdef CONFIG_FSL_SOC -static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = { +static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = {  	{160, 0x0120}, {192, 0x0121}, {224, 0x0122}, {256, 0x0123},  	{288, 0x0100}, {320, 0x0101}, {352, 0x0601}, {384, 0x0102},  	{416, 0x0602}, {448, 0x0126}, {480, 0x0103}, {512, 0x0127}, @@ -316,7 +316,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] __devinitconst = {  	{49152, 0x011e}, {61440, 0x011f}  }; -static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void) +static u32 mpc_i2c_get_sec_cfg_8xxx(void)  {  	struct device_node *node = NULL;  	u32 __iomem *reg; @@ -345,7 +345,7 @@ static u32 __devinit mpc_i2c_get_sec_cfg_8xxx(void)  	return val;  } -static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock, +static int mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,  					  u32 prescaler, u32 *real_clk)  {  	const struct mpc_i2c_divider *div = NULL; @@ -383,7 +383,7 @@ static int __devinit mpc_i2c_get_fdr_8xxx(struct device_node *node, u32 clock,  	return div ? (int)div->fdr : -EINVAL;  } -static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, +static void mpc_i2c_setup_8xxx(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -408,7 +408,7 @@ static void __devinit mpc_i2c_setup_8xxx(struct device_node *node,  }  #else /* !CONFIG_FSL_SOC */ -static void __devinit mpc_i2c_setup_8xxx(struct device_node *node, +static void mpc_i2c_setup_8xxx(struct device_node *node,  					 struct mpc_i2c *i2c,  					 u32 clock, u32 prescaler)  { @@ -615,7 +615,7 @@ static struct i2c_adapter mpc_ops = {  };  static const struct of_device_id mpc_i2c_of_match[]; -static int __devinit fsl_i2c_probe(struct platform_device *op) +static int fsl_i2c_probe(struct platform_device *op)  {  	const struct of_device_id *match;  	struct mpc_i2c *i2c; @@ -706,7 +706,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)  	return result;  }; -static int __devexit fsl_i2c_remove(struct platform_device *op) +static int fsl_i2c_remove(struct platform_device *op)  {  	struct mpc_i2c *i2c = dev_get_drvdata(&op->dev); @@ -746,24 +746,24 @@ static int mpc_i2c_resume(struct device *dev)  SIMPLE_DEV_PM_OPS(mpc_i2c_pm_ops, mpc_i2c_suspend, mpc_i2c_resume);  #endif -static const struct mpc_i2c_data mpc_i2c_data_512x __devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_512x = {  	.setup = mpc_i2c_setup_512x,  }; -static const struct mpc_i2c_data mpc_i2c_data_52xx __devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_52xx = {  	.setup = mpc_i2c_setup_52xx,  }; -static const struct mpc_i2c_data mpc_i2c_data_8313 __devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8313 = {  	.setup = mpc_i2c_setup_8xxx,  }; -static const struct mpc_i2c_data mpc_i2c_data_8543 __devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8543 = {  	.setup = mpc_i2c_setup_8xxx,  	.prescaler = 2,  }; -static const struct mpc_i2c_data mpc_i2c_data_8544 __devinitdata = { +static const struct mpc_i2c_data mpc_i2c_data_8544 = {  	.setup = mpc_i2c_setup_8xxx,  	.prescaler = 3,  }; @@ -785,7 +785,7 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);  /* Structure for a device driver */  static struct platform_driver mpc_i2c_driver = {  	.probe		= fsl_i2c_probe, -	.remove		= __devexit_p(fsl_i2c_remove), +	.remove		= fsl_i2c_remove,  	.driver = {  		.owner = THIS_MODULE,  		.name = DRV_NAME, diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 2e9d56719e9..8b20ef8524a 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -495,7 +495,7 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {   *   *****************************************************************************   */ -static int __devinit +static int  mv64xxx_i2c_map_regs(struct platform_device *pd,  	struct mv64xxx_i2c_data *drv_data)  { @@ -530,13 +530,13 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)  }  #ifdef CONFIG_OF -static int __devinit +static int  mv64xxx_calc_freq(const int tclk, const int n, const int m)  {  	return tclk / (10 * (m + 1) * (2 << n));  } -static bool __devinit +static bool  mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,  			  u32 *best_m)  { @@ -560,7 +560,7 @@ mv64xxx_find_baud_factors(const u32 req_freq, const u32 tclk, u32 *best_n,  	return true;  } -static int __devinit +static int  mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,  		  struct device_node *np)  { @@ -597,7 +597,7 @@ out:  #endif  }  #else /* CONFIG_OF */ -static int __devinit +static int  mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,  		  struct device_node *np)  { @@ -605,7 +605,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data,  }  #endif /* CONFIG_OF */ -static int __devinit +static int  mv64xxx_i2c_probe(struct platform_device *pd)  {  	struct mv64xxx_i2c_data		*drv_data; @@ -697,7 +697,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)  	return rc;  } -static int __devexit +static int  mv64xxx_i2c_remove(struct platform_device *dev)  {  	struct mv64xxx_i2c_data		*drv_data = platform_get_drvdata(dev); @@ -718,7 +718,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)  	return rc;  } -static const struct of_device_id mv64xxx_i2c_of_match_table[] __devinitdata = { +static const struct of_device_id mv64xxx_i2c_of_match_table[] = {  	{ .compatible = "marvell,mv64xxx-i2c", },  	{}  }; @@ -726,7 +726,7 @@ MODULE_DEVICE_TABLE(of, mv64xxx_i2c_of_match_table);  static struct platform_driver mv64xxx_i2c_driver = {  	.probe	= mv64xxx_i2c_probe, -	.remove	= __devexit_p(mv64xxx_i2c_remove), +	.remove	= mv64xxx_i2c_remove,  	.driver	= {  		.owner	= THIS_MODULE,  		.name	= MV64XXX_I2C_CTLR_NAME, diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 6ed53da9e1f..1b1a936eccc 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -432,7 +432,7 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)  	return 0;  } -static int __devinit mxs_i2c_probe(struct platform_device *pdev) +static int mxs_i2c_probe(struct platform_device *pdev)  {  	struct device *dev = &pdev->dev;  	struct mxs_i2c_dev *i2c; @@ -515,7 +515,7 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit mxs_i2c_remove(struct platform_device *pdev) +static int mxs_i2c_remove(struct platform_device *pdev)  {  	struct mxs_i2c_dev *i2c = platform_get_drvdata(pdev);  	int ret; @@ -546,7 +546,7 @@ static struct platform_driver mxs_i2c_driver = {  		   .owner = THIS_MODULE,  		   .of_match_table = mxs_i2c_dt_ids,  		   }, -	.remove = __devexit_p(mxs_i2c_remove), +	.remove = mxs_i2c_remove,  };  static int __init mxs_i2c_init(void) diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 392303b4be0..adac8542771 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c @@ -117,7 +117,7 @@ struct nforce2_smbus {  #define MAX_TIMEOUT	100  /* We disable the second SMBus channel on these boards */ -static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = { +static const struct dmi_system_id nforce2_dmi_blacklist2[] = {  	{  		.ident = "DFI Lanparty NF4 Expert",  		.matches = { @@ -330,8 +330,8 @@ static DEFINE_PCI_DEVICE_TABLE(nforce2_ids) = {  MODULE_DEVICE_TABLE (pci, nforce2_ids); -static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, -	int alt_reg, struct nforce2_smbus *smbus, const char *name) +static int nforce2_probe_smb(struct pci_dev *dev, int bar, int alt_reg, +			     struct nforce2_smbus *smbus, const char *name)  {  	int error; @@ -382,7 +382,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,  } -static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int nforce2_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	struct nforce2_smbus *smbuses;  	int res1, res2; @@ -430,7 +430,7 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_  } -static void __devexit nforce2_remove(struct pci_dev *dev) +static void nforce2_remove(struct pci_dev *dev)  {  	struct nforce2_smbus *smbuses = pci_get_drvdata(dev); @@ -450,7 +450,7 @@ static struct pci_driver nforce2_driver = {  	.name		= "nForce2_smbus",  	.id_table	= nforce2_ids,  	.probe		= nforce2_probe, -	.remove		= __devexit_p(nforce2_remove), +	.remove		= nforce2_remove,  };  module_pci_driver(nforce2_driver); diff --git a/drivers/i2c/busses/i2c-nuc900.c b/drivers/i2c/busses/i2c-nuc900.c index a23b91b0b73..865ee350adb 100644 --- a/drivers/i2c/busses/i2c-nuc900.c +++ b/drivers/i2c/busses/i2c-nuc900.c @@ -518,7 +518,7 @@ static const struct i2c_algorithm nuc900_i2c_algorithm = {   * called by the bus driver when a suitable device is found  */ -static int __devinit nuc900_i2c_probe(struct platform_device *pdev) +static int nuc900_i2c_probe(struct platform_device *pdev)  {  	struct nuc900_i2c *i2c;  	struct nuc900_platform_i2c *pdata; @@ -663,7 +663,7 @@ static int __devinit nuc900_i2c_probe(struct platform_device *pdev)   * called when device is removed from the bus  */ -static int __devexit nuc900_i2c_remove(struct platform_device *pdev) +static int nuc900_i2c_remove(struct platform_device *pdev)  {  	struct nuc900_i2c *i2c = platform_get_drvdata(pdev); @@ -684,7 +684,7 @@ static int __devexit nuc900_i2c_remove(struct platform_device *pdev)  static struct platform_driver nuc900_i2c_driver = {  	.probe		= nuc900_i2c_probe, -	.remove		= __devexit_p(nuc900_i2c_remove), +	.remove		= nuc900_i2c_remove,  	.driver		= {  		.owner	= THIS_MODULE,  		.name	= "nuc900-i2c0", diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index 9b35c9fbb2f..a873d0ad1ac 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -343,7 +343,7 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,  #define ocores_i2c_of_probe(pdev,i2c) -ENODEV  #endif -static int __devinit ocores_i2c_probe(struct platform_device *pdev) +static int ocores_i2c_probe(struct platform_device *pdev)  {  	struct ocores_i2c *i2c;  	struct ocores_i2c_platform_data *pdata; @@ -441,7 +441,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit ocores_i2c_remove(struct platform_device *pdev) +static int ocores_i2c_remove(struct platform_device *pdev)  {  	struct ocores_i2c *i2c = platform_get_drvdata(pdev); @@ -485,7 +485,7 @@ static SIMPLE_DEV_PM_OPS(ocores_i2c_pm, ocores_i2c_suspend, ocores_i2c_resume);  static struct platform_driver ocores_i2c_driver = {  	.probe   = ocores_i2c_probe, -	.remove  = __devexit_p(ocores_i2c_remove), +	.remove  = ocores_i2c_remove,  	.driver  = {  		.owner = THIS_MODULE,  		.name = "ocores-i2c", diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c index f44c83549fe..484ca771fdf 100644 --- a/drivers/i2c/busses/i2c-octeon.c +++ b/drivers/i2c/busses/i2c-octeon.c @@ -446,7 +446,7 @@ static struct i2c_adapter octeon_i2c_ops = {  /**   * octeon_i2c_setclock - Calculate and set clock divisors.   */ -static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c) +static int octeon_i2c_setclock(struct octeon_i2c *i2c)  {  	int tclk, thp_base, inc, thp_idx, mdiv_idx, ndiv_idx, foscl, diff;  	int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = 1000000; @@ -489,7 +489,7 @@ static int __devinit octeon_i2c_setclock(struct octeon_i2c *i2c)  	return 0;  } -static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c) +static int octeon_i2c_initlowlevel(struct octeon_i2c *i2c)  {  	u8 status;  	int tries; @@ -510,7 +510,7 @@ static int __devinit octeon_i2c_initlowlevel(struct octeon_i2c *i2c)  	return -EIO;  } -static int __devinit octeon_i2c_probe(struct platform_device *pdev) +static int octeon_i2c_probe(struct platform_device *pdev)  {  	int irq, result = 0;  	struct octeon_i2c *i2c; @@ -609,7 +609,7 @@ out:  	return result;  }; -static int __devexit octeon_i2c_remove(struct platform_device *pdev) +static int octeon_i2c_remove(struct platform_device *pdev)  {  	struct octeon_i2c *i2c = platform_get_drvdata(pdev); @@ -628,7 +628,7 @@ MODULE_DEVICE_TABLE(of, octeon_i2c_match);  static struct platform_driver octeon_i2c_driver = {  	.probe		= octeon_i2c_probe, -	.remove		= __devexit_p(octeon_i2c_remove), +	.remove		= octeon_i2c_remove,  	.driver		= {  		.owner	= THIS_MODULE,  		.name	= DRV_NAME, diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 7a62acb7d26..20d41bfa7c1 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1069,7 +1069,7 @@ MODULE_DEVICE_TABLE(of, omap_i2c_of_match);  #define OMAP_I2C_SCHEME_0		0  #define OMAP_I2C_SCHEME_1		1 -static int __devinit +static int  omap_i2c_probe(struct platform_device *pdev)  {  	struct omap_i2c_dev	*dev; @@ -1267,7 +1267,7 @@ err_free_mem:  	return r;  } -static int __devexit omap_i2c_remove(struct platform_device *pdev) +static int omap_i2c_remove(struct platform_device *pdev)  {  	struct omap_i2c_dev	*dev = platform_get_drvdata(pdev);  	int ret; @@ -1333,7 +1333,7 @@ static struct dev_pm_ops omap_i2c_pm_ops = {  static struct platform_driver omap_i2c_driver = {  	.probe		= omap_i2c_probe, -	.remove		= __devexit_p(omap_i2c_remove), +	.remove		= omap_i2c_remove,  	.driver		= {  		.name	= "omap_i2c",  		.owner	= THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index 4b95f7a63a3..aa957788192 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c @@ -135,7 +135,7 @@ static struct lineop parport_ctrl_irq = {  	.port		= PORT_CTRL,  }; -static int __devinit i2c_parport_probe(struct platform_device *pdev) +static int i2c_parport_probe(struct platform_device *pdev)  {  	int err; @@ -169,7 +169,7 @@ static int __devinit i2c_parport_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit i2c_parport_remove(struct platform_device *pdev) +static int i2c_parport_remove(struct platform_device *pdev)  {  	if (ara) {  		line_set(0, &parport_ctrl_irq); @@ -191,7 +191,7 @@ static struct platform_driver i2c_parport_driver = {  		.name	= DRVNAME,  	},  	.probe		= i2c_parport_probe, -	.remove		= __devexit_p(i2c_parport_remove), +	.remove		= i2c_parport_remove,  };  static int __init i2c_parport_device_add(u16 address) diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index 12edefd4183..615f632c846 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c @@ -340,7 +340,7 @@ static const struct i2c_algorithm smbus_algorithm = {  	.functionality	= pasemi_smb_func,  }; -static int __devinit pasemi_smb_probe(struct pci_dev *dev, +static int pasemi_smb_probe(struct pci_dev *dev,  				      const struct pci_device_id *id)  {  	struct pasemi_smbus *smbus; @@ -392,7 +392,7 @@ static int __devinit pasemi_smb_probe(struct pci_dev *dev,  	return error;  } -static void __devexit pasemi_smb_remove(struct pci_dev *dev) +static void pasemi_smb_remove(struct pci_dev *dev)  {  	struct pasemi_smbus *smbus = pci_get_drvdata(dev); @@ -412,7 +412,7 @@ static struct pci_driver pasemi_smb_driver = {  	.name		= "i2c-pasemi",  	.id_table	= pasemi_smb_ids,  	.probe		= pasemi_smb_probe, -	.remove		= __devexit_p(pasemi_smb_remove), +	.remove		= pasemi_smb_remove,  };  module_pci_driver(pasemi_smb_driver); diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index 29933f87d8f..323f061a316 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c @@ -119,7 +119,7 @@ static struct i2c_adapter pca_isa_ops = {  	.timeout	= HZ,  }; -static int __devinit pca_isa_match(struct device *dev, unsigned int id) +static int pca_isa_match(struct device *dev, unsigned int id)  {  	int match = base != 0; @@ -132,7 +132,7 @@ static int __devinit pca_isa_match(struct device *dev, unsigned int id)  	return match;  } -static int __devinit pca_isa_probe(struct device *dev, unsigned int id) +static int pca_isa_probe(struct device *dev, unsigned int id)  {  	init_waitqueue_head(&pca_wait); @@ -174,7 +174,7 @@ static int __devinit pca_isa_probe(struct device *dev, unsigned int id)  	return -ENODEV;  } -static int __devexit pca_isa_remove(struct device *dev, unsigned int id) +static int pca_isa_remove(struct device *dev, unsigned int id)  {  	i2c_del_adapter(&pca_isa_ops); @@ -190,7 +190,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id)  static struct isa_driver pca_isa_driver = {  	.match		= pca_isa_match,  	.probe		= pca_isa_probe, -	.remove		= __devexit_p(pca_isa_remove), +	.remove		= pca_isa_remove,  	.driver = {  		.owner	= THIS_MODULE,  		.name	= DRIVER, diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index 675878f49f7..a30d2f613c0 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c @@ -131,7 +131,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)  } -static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) +static int i2c_pca_pf_probe(struct platform_device *pdev)  {  	struct i2c_pca_pf_data *i2c;  	struct resource *res; @@ -257,7 +257,7 @@ e_print:  	return ret;  } -static int __devexit i2c_pca_pf_remove(struct platform_device *pdev) +static int i2c_pca_pf_remove(struct platform_device *pdev)  {  	struct i2c_pca_pf_data *i2c = platform_get_drvdata(pdev);  	platform_set_drvdata(pdev, NULL); @@ -279,7 +279,7 @@ static int __devexit i2c_pca_pf_remove(struct platform_device *pdev)  static struct platform_driver i2c_pca_pf_driver = {  	.probe = i2c_pca_pf_probe, -	.remove = __devexit_p(i2c_pca_pf_remove), +	.remove = i2c_pca_pf_remove,  	.driver = {  		.name = "i2c-pca-platform",  		.owner = THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index f7216ed2f3a..39ab78c1a02 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c @@ -99,7 +99,7 @@ MODULE_PARM_DESC(force_addr,  static int srvrworks_csb5_delay;  static struct pci_driver piix4_driver; -static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { +static const struct dmi_system_id piix4_dmi_blacklist[] = {  	{  		.ident = "Sapphire AM2RD790",  		.matches = { @@ -119,7 +119,7 @@ static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = {  /* The IBM entry is in a separate table because we only check it     on Intel-based systems */ -static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { +static const struct dmi_system_id piix4_dmi_ibm[] = {  	{  		.ident = "IBM",  		.matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, @@ -131,8 +131,8 @@ struct i2c_piix4_adapdata {  	unsigned short smba;  }; -static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, -				const struct pci_device_id *id) +static int piix4_setup(struct pci_dev *PIIX4_dev, +		       const struct pci_device_id *id)  {  	unsigned char temp;  	unsigned short piix4_smba; @@ -230,8 +230,8 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev,  	return piix4_smba;  } -static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev, -				const struct pci_device_id *id) +static int piix4_setup_sb800(struct pci_dev *PIIX4_dev, +			     const struct pci_device_id *id)  {  	unsigned short piix4_smba;  	unsigned short smba_idx = 0xcd6; @@ -294,9 +294,9 @@ static int __devinit piix4_setup_sb800(struct pci_dev *PIIX4_dev,  	return piix4_smba;  } -static int __devinit piix4_setup_aux(struct pci_dev *PIIX4_dev, -				const struct pci_device_id *id, -				unsigned short base_reg_addr) +static int piix4_setup_aux(struct pci_dev *PIIX4_dev, +			   const struct pci_device_id *id, +			   unsigned short base_reg_addr)  {  	/* Set up auxiliary SMBus controllers found on some  	 * AMD chipsets e.g. SP5100 (SB700 derivative) */ @@ -540,9 +540,8 @@ MODULE_DEVICE_TABLE (pci, piix4_ids);  static struct i2c_adapter *piix4_main_adapter;  static struct i2c_adapter *piix4_aux_adapter; -static int __devinit piix4_add_adapter(struct pci_dev *dev, -					unsigned short smba, -					struct i2c_adapter **padap) +static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba, +			     struct i2c_adapter **padap)  {  	struct i2c_adapter *adap;  	struct i2c_piix4_adapdata *adapdata; @@ -588,8 +587,7 @@ static int __devinit piix4_add_adapter(struct pci_dev *dev,  	return 0;  } -static int __devinit piix4_probe(struct pci_dev *dev, -				const struct pci_device_id *id) +static int piix4_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	int retval; @@ -626,7 +624,7 @@ static int __devinit piix4_probe(struct pci_dev *dev,  	return 0;  } -static void __devexit piix4_adap_remove(struct i2c_adapter *adap) +static void piix4_adap_remove(struct i2c_adapter *adap)  {  	struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); @@ -638,7 +636,7 @@ static void __devexit piix4_adap_remove(struct i2c_adapter *adap)  	}  } -static void __devexit piix4_remove(struct pci_dev *dev) +static void piix4_remove(struct pci_dev *dev)  {  	if (piix4_main_adapter) {  		piix4_adap_remove(piix4_main_adapter); @@ -655,7 +653,7 @@ static struct pci_driver piix4_driver = {  	.name		= "piix4_smbus",  	.id_table	= piix4_ids,  	.probe		= piix4_probe, -	.remove		= __devexit_p(piix4_remove), +	.remove		= piix4_remove,  };  module_pci_driver(piix4_driver); diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c index 3d71395ae1f..083d68cfaf0 100644 --- a/drivers/i2c/busses/i2c-pmcmsp.c +++ b/drivers/i2c/busses/i2c-pmcmsp.c @@ -270,7 +270,7 @@ static irqreturn_t pmcmsptwi_interrupt(int irq, void *ptr)  /*   * Probe for and register the device and return 0 if there is one.   */ -static int __devinit pmcmsptwi_probe(struct platform_device *pldev) +static int pmcmsptwi_probe(struct platform_device *pldev)  {  	struct resource *res;  	int rc = -ENODEV; @@ -368,7 +368,7 @@ ret_err:  /*   * Release the device and return 0 if there is one.   */ -static int __devexit pmcmsptwi_remove(struct platform_device *pldev) +static int pmcmsptwi_remove(struct platform_device *pldev)  {  	struct resource *res; @@ -628,7 +628,7 @@ static struct i2c_adapter pmcmsptwi_adapter = {  static struct platform_driver pmcmsptwi_driver = {  	.probe  = pmcmsptwi_probe, -	.remove	= __devexit_p(pmcmsptwi_remove), +	.remove	= pmcmsptwi_remove,  	.driver = {  		.name	= DRV_NAME,  		.owner	= THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 8488bddfe46..ce4097012e9 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -619,7 +619,7 @@ static SIMPLE_DEV_PM_OPS(i2c_pnx_pm,  #define PNX_I2C_PM	NULL  #endif -static int __devinit i2c_pnx_probe(struct platform_device *pdev) +static int i2c_pnx_probe(struct platform_device *pdev)  {  	unsigned long tmp;  	int ret = 0; @@ -765,7 +765,7 @@ err_kzalloc:  	return ret;  } -static int __devexit i2c_pnx_remove(struct platform_device *pdev) +static int i2c_pnx_remove(struct platform_device *pdev)  {  	struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); @@ -797,7 +797,7 @@ static struct platform_driver i2c_pnx_driver = {  		.pm = PNX_I2C_PM,  	},  	.probe = i2c_pnx_probe, -	.remove = __devexit_p(i2c_pnx_remove), +	.remove = i2c_pnx_remove,  };  static int __init i2c_adap_pnx_init(void) diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 5285f8565de..0dd5b334d09 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c @@ -210,7 +210,7 @@ static const struct i2c_algorithm i2c_powermac_algorithm = {  }; -static int __devexit i2c_powermac_remove(struct platform_device *dev) +static int i2c_powermac_remove(struct platform_device *dev)  {  	struct i2c_adapter	*adapter = platform_get_drvdata(dev);  	int			rc; @@ -227,7 +227,7 @@ static int __devexit i2c_powermac_remove(struct platform_device *dev)  	return 0;  } -static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap, +static u32 i2c_powermac_get_addr(struct i2c_adapter *adap,  					   struct pmac_i2c_bus *bus,  					   struct device_node *node)  { @@ -255,7 +255,7 @@ static u32 __devinit i2c_powermac_get_addr(struct i2c_adapter *adap,  	return 0xffffffff;  } -static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap, +static void i2c_powermac_create_one(struct i2c_adapter *adap,  					      const char *type,  					      u32 addr)  { @@ -271,7 +271,7 @@ static void __devinit i2c_powermac_create_one(struct i2c_adapter *adap,  			type);  } -static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap, +static void i2c_powermac_add_missing(struct i2c_adapter *adap,  					       struct pmac_i2c_bus *bus,  					       bool found_onyx)  { @@ -297,7 +297,7 @@ static void __devinit i2c_powermac_add_missing(struct i2c_adapter *adap,  	}  } -static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap, +static bool i2c_powermac_get_type(struct i2c_adapter *adap,  					    struct device_node *node,  					    u32 addr, char *type, int type_size)  { @@ -336,7 +336,7 @@ static bool __devinit i2c_powermac_get_type(struct i2c_adapter *adap,  	return false;  } -static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap, +static void i2c_powermac_register_devices(struct i2c_adapter *adap,  						    struct pmac_i2c_bus *bus)  {  	struct i2c_client *newdev; @@ -403,7 +403,7 @@ static void __devinit i2c_powermac_register_devices(struct i2c_adapter *adap,  	i2c_powermac_add_missing(adap, bus, found_onyx);  } -static int __devinit i2c_powermac_probe(struct platform_device *dev) +static int i2c_powermac_probe(struct platform_device *dev)  {  	struct pmac_i2c_bus *bus = dev->dev.platform_data;  	struct device_node *parent = NULL; @@ -467,7 +467,7 @@ static int __devinit i2c_powermac_probe(struct platform_device *dev)  static struct platform_driver i2c_powermac_driver = {  	.probe = i2c_powermac_probe, -	.remove = __devexit_p(i2c_powermac_remove), +	.remove = i2c_powermac_remove,  	.driver = {  		.name = "i2c-powermac",  		.bus = &platform_bus_type, diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c index d8515be00b9..d7c512d717a 100644 --- a/drivers/i2c/busses/i2c-puv3.c +++ b/drivers/i2c/busses/i2c-puv3.c @@ -184,7 +184,7 @@ static struct i2c_algorithm puv3_i2c_algorithm = {  /*   * Main initialization routine.   */ -static int __devinit puv3_i2c_probe(struct platform_device *pdev) +static int puv3_i2c_probe(struct platform_device *pdev)  {  	struct i2c_adapter *adapter;  	struct resource *mem; @@ -231,7 +231,7 @@ fail_nomem:  	return rc;  } -static int __devexit puv3_i2c_remove(struct platform_device *pdev) +static int puv3_i2c_remove(struct platform_device *pdev)  {  	struct i2c_adapter *adapter = platform_get_drvdata(pdev);  	struct resource *mem; @@ -276,7 +276,7 @@ static SIMPLE_DEV_PM_OPS(puv3_i2c_pm, puv3_i2c_suspend, NULL);  static struct platform_driver puv3_i2c_driver = {  	.probe		= puv3_i2c_probe, -	.remove		= __devexit_p(puv3_i2c_remove), +	.remove		= puv3_i2c_remove,  	.driver		= {  		.name	= "PKUnity-v3-I2C",  		.owner	= THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-pxa-pci.c b/drivers/i2c/busses/i2c-pxa-pci.c index 4dc9bef17d7..3d4985695ae 100644 --- a/drivers/i2c/busses/i2c-pxa-pci.c +++ b/drivers/i2c/busses/i2c-pxa-pci.c @@ -94,7 +94,7 @@ out:  	return ERR_PTR(ret);  } -static int __devinit ce4100_i2c_probe(struct pci_dev *dev, +static int ce4100_i2c_probe(struct pci_dev *dev,  		const struct pci_device_id *ent)  {  	int ret; @@ -135,7 +135,7 @@ err_mem:  	return ret;  } -static void __devexit ce4100_i2c_remove(struct pci_dev *dev) +static void ce4100_i2c_remove(struct pci_dev *dev)  {  	struct ce4100_devices *sds;  	unsigned int i; @@ -160,7 +160,7 @@ static struct pci_driver ce4100_i2c_driver = {  	.name           = "ce4100_i2c",  	.id_table       = ce4100_i2c_devices,  	.probe          = ce4100_i2c_probe, -	.remove         = __devexit_p(ce4100_i2c_remove), +	.remove         = ce4100_i2c_remove,  };  module_pci_driver(ce4100_i2c_driver); diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 72a8071a555..9bd4d73d29e 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -613,7 +613,7 @@ static const struct i2c_algorithm rcar_i2c_algo = {  	.functionality	= rcar_i2c_func,  }; -static int __devinit rcar_i2c_probe(struct platform_device *pdev) +static int rcar_i2c_probe(struct platform_device *pdev)  {  	struct i2c_rcar_platform_data *pdata = pdev->dev.platform_data;  	struct rcar_i2c_priv *priv; @@ -682,7 +682,7 @@ static int __devinit rcar_i2c_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit rcar_i2c_remove(struct platform_device *pdev) +static int rcar_i2c_remove(struct platform_device *pdev)  {  	struct rcar_i2c_priv *priv = platform_get_drvdata(pdev);  	struct device *dev = &pdev->dev; @@ -699,7 +699,7 @@ static struct platform_driver rcar_i2c_driver = {  		.owner	= THIS_MODULE,  	},  	.probe		= rcar_i2c_probe, -	.remove		= __devexit_p(rcar_i2c_remove), +	.remove		= rcar_i2c_remove,  };  module_platform_driver(rcar_i2c_driver); diff --git a/drivers/i2c/busses/i2c-s6000.c b/drivers/i2c/busses/i2c-s6000.c index b76a29d1f8e..008836409ef 100644 --- a/drivers/i2c/busses/i2c-s6000.c +++ b/drivers/i2c/busses/i2c-s6000.c @@ -248,7 +248,7 @@ static struct i2c_algorithm s6i2c_algorithm = {  	.functionality = s6i2c_functionality,  }; -static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns) +static u16 nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)  {  	u32 dividend = ((clk_get_rate(iface->clk) / 1000) * ns) / 1000000;  	if (dividend > 0xffff) @@ -256,7 +256,7 @@ static u16 __devinit nanoseconds_on_clk(struct s6i2c_if *iface, u32 ns)  	return dividend;  } -static int __devinit s6i2c_probe(struct platform_device *dev) +static int s6i2c_probe(struct platform_device *dev)  {  	struct s6i2c_if *iface = &s6i2c_if;  	struct i2c_adapter *p_adap; @@ -361,7 +361,7 @@ err_out:  	return rc;  } -static int __devexit s6i2c_remove(struct platform_device *pdev) +static int s6i2c_remove(struct platform_device *pdev)  {  	struct s6i2c_if *iface = platform_get_drvdata(pdev);  	i2c_wr16(iface, S6_I2C_ENABLE, 0); @@ -378,7 +378,7 @@ static int __devexit s6i2c_remove(struct platform_device *pdev)  static struct platform_driver s6i2c_driver = {  	.probe		= s6i2c_probe, -	.remove		= __devexit_p(s6i2c_remove), +	.remove		= s6i2c_remove,  	.driver		= {  		.name	= DRV_NAME,  		.owner	= THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-sh7760.c b/drivers/i2c/busses/i2c-sh7760.c index c0c9dffbdb1..3a2253e1bf5 100644 --- a/drivers/i2c/busses/i2c-sh7760.c +++ b/drivers/i2c/busses/i2c-sh7760.c @@ -390,7 +390,7 @@ static const struct i2c_algorithm sh7760_i2c_algo = {   * iclk = mclk/(CDF + 1).  iclk must be < 20MHz.   * scl = iclk/(SCGD*8 + 20).   */ -static int __devinit calc_CCR(unsigned long scl_hz) +static int calc_CCR(unsigned long scl_hz)  {  	struct clk *mclk;  	unsigned long mck, m1, dff, odff, iclk; @@ -430,7 +430,7 @@ static int __devinit calc_CCR(unsigned long scl_hz)  	return ((scgdm << 2) | cdfm);  } -static int __devinit sh7760_i2c_probe(struct platform_device *pdev) +static int sh7760_i2c_probe(struct platform_device *pdev)  {  	struct sh7760_i2c_platdata *pd;  	struct resource *res; @@ -536,7 +536,7 @@ out0:  	return ret;  } -static int __devexit sh7760_i2c_remove(struct platform_device *pdev) +static int sh7760_i2c_remove(struct platform_device *pdev)  {  	struct cami2c *id = platform_get_drvdata(pdev); @@ -557,7 +557,7 @@ static struct platform_driver sh7760_i2c_drv = {  		.owner	= THIS_MODULE,  	},  	.probe		= sh7760_i2c_probe, -	.remove		= __devexit_p(sh7760_i2c_remove), +	.remove		= sh7760_i2c_remove,  };  module_platform_driver(sh7760_i2c_drv); diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 9411c1b892c..b6e7a83a829 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -758,7 +758,7 @@ static const struct dev_pm_ops sh_mobile_i2c_dev_pm_ops = {  	.runtime_resume = sh_mobile_i2c_runtime_nop,  }; -static const struct of_device_id sh_mobile_i2c_dt_ids[] __devinitconst = { +static const struct of_device_id sh_mobile_i2c_dt_ids[] = {  	{ .compatible = "renesas,rmobile-iic", },  	{},  }; diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c index 5574a47792f..3f1818b8797 100644 --- a/drivers/i2c/busses/i2c-sirf.c +++ b/drivers/i2c/busses/i2c-sirf.c @@ -258,7 +258,7 @@ static const struct i2c_algorithm i2c_sirfsoc_algo = {  	.functionality = i2c_sirfsoc_func,  }; -static int __devinit i2c_sirfsoc_probe(struct platform_device *pdev) +static int i2c_sirfsoc_probe(struct platform_device *pdev)  {  	struct sirfsoc_i2c *siic;  	struct i2c_adapter *adap; @@ -385,7 +385,7 @@ err_get_clk:  	return err;  } -static int __devexit i2c_sirfsoc_remove(struct platform_device *pdev) +static int i2c_sirfsoc_remove(struct platform_device *pdev)  {  	struct i2c_adapter *adapter = platform_get_drvdata(pdev);  	struct sirfsoc_i2c *siic = adapter->algo_data; @@ -433,7 +433,7 @@ static const struct dev_pm_ops i2c_sirfsoc_pm_ops = {  };  #endif -static const struct of_device_id sirfsoc_i2c_of_match[] __devinitconst = { +static const struct of_device_id sirfsoc_i2c_of_match[] = {  	{ .compatible = "sirf,prima2-i2c", },  	{},  }; @@ -449,7 +449,7 @@ static struct platform_driver i2c_sirfsoc_driver = {  		.of_match_table = sirfsoc_i2c_of_match,  	},  	.probe = i2c_sirfsoc_probe, -	.remove = __devexit_p(i2c_sirfsoc_remove), +	.remove = i2c_sirfsoc_remove,  };  module_platform_driver(i2c_sirfsoc_driver); diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 87e5126d449..79fd96a0438 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c @@ -142,7 +142,7 @@ static void sis5595_write(u8 reg, u8 data)  	outb(data, sis5595_base + SMB_DAT);  } -static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev) +static int sis5595_setup(struct pci_dev *SIS5595_dev)  {  	u16 a;  	u8 val; @@ -376,7 +376,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis5595_ids) = {  MODULE_DEVICE_TABLE (pci, sis5595_ids); -static int __devinit sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int sis5595_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	int err; diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index 5d6723b7525..de6dddb9f86 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c @@ -389,7 +389,7 @@ static u32 sis630_func(struct i2c_adapter *adapter)  		I2C_FUNC_SMBUS_BLOCK_DATA;  } -static int __devinit sis630_setup(struct pci_dev *sis630_dev) +static int sis630_setup(struct pci_dev *sis630_dev)  {  	unsigned char b;  	struct pci_dev *dummy = NULL; @@ -480,7 +480,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis630_ids) = {  MODULE_DEVICE_TABLE (pci, sis630_ids); -static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	if (sis630_setup(dev)) {  		dev_err(&dev->dev, "SIS630 comp. bus not detected, module not inserted.\n"); @@ -496,7 +496,7 @@ static int __devinit sis630_probe(struct pci_dev *dev, const struct pci_device_i  	return i2c_add_adapter(&sis630_adapter);  } -static void __devexit sis630_remove(struct pci_dev *dev) +static void sis630_remove(struct pci_dev *dev)  {  	if (acpi_base) {  		i2c_del_adapter(&sis630_adapter); @@ -510,7 +510,7 @@ static struct pci_driver sis630_driver = {  	.name		= "sis630_smbus",  	.id_table	= sis630_ids,  	.probe		= sis630_probe, -	.remove		= __devexit_p(sis630_remove), +	.remove		= sis630_remove,  };  module_pci_driver(sis630_driver); diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 7b72614a9bc..b9faf9b6002 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c @@ -252,7 +252,7 @@ static DEFINE_PCI_DEVICE_TABLE(sis96x_ids) = {  MODULE_DEVICE_TABLE (pci, sis96x_ids); -static int __devinit sis96x_probe(struct pci_dev *dev, +static int sis96x_probe(struct pci_dev *dev,  				const struct pci_device_id *id)  {  	u16 ww = 0; @@ -308,7 +308,7 @@ static int __devinit sis96x_probe(struct pci_dev *dev,  	return retval;  } -static void __devexit sis96x_remove(struct pci_dev *dev) +static void sis96x_remove(struct pci_dev *dev)  {  	if (sis96x_smbus_base) {  		i2c_del_adapter(&sis96x_adapter); @@ -321,7 +321,7 @@ static struct pci_driver sis96x_driver = {  	.name		= "sis96x_smbus",  	.id_table	= sis96x_ids,  	.probe		= sis96x_probe, -	.remove		= __devexit_p(sis96x_remove), +	.remove		= sis96x_remove,  };  module_pci_driver(sis96x_driver); diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index dcea77bf6f5..7b38877ffec 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -642,7 +642,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {  #if defined(CONFIG_OF)  /* Match table for of_platform binding */ -static const struct of_device_id tegra_i2c_of_match[] __devinitconst = { +static const struct of_device_id tegra_i2c_of_match[] = {  	{ .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },  	{ .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },  	{ .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, }, @@ -651,7 +651,7 @@ static const struct of_device_id tegra_i2c_of_match[] __devinitconst = {  MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);  #endif -static int __devinit tegra_i2c_probe(struct platform_device *pdev) +static int tegra_i2c_probe(struct platform_device *pdev)  {  	struct tegra_i2c_dev *i2c_dev;  	struct tegra_i2c_platform_data *pdata = pdev->dev.platform_data; @@ -769,7 +769,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit tegra_i2c_remove(struct platform_device *pdev) +static int tegra_i2c_remove(struct platform_device *pdev)  {  	struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev);  	i2c_del_adapter(&i2c_dev->adapter); @@ -817,7 +817,7 @@ static SIMPLE_DEV_PM_OPS(tegra_i2c_pm, tegra_i2c_suspend, tegra_i2c_resume);  static struct platform_driver tegra_i2c_driver = {  	.probe   = tegra_i2c_probe, -	.remove  = __devexit_p(tegra_i2c_remove), +	.remove  = tegra_i2c_remove,  	.driver  = {  		.name  = "tegra-i2c",  		.owner = THIS_MODULE, diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 7ffee71ca19..be662511c58 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c @@ -96,7 +96,7 @@ static DEFINE_PCI_DEVICE_TABLE(vt586b_ids) = {  MODULE_DEVICE_TABLE (pci, vt586b_ids); -static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)  {  	u16 base;  	u8 rev; @@ -146,7 +146,7 @@ static int __devinit vt586b_probe(struct pci_dev *dev, const struct pci_device_i  	return 0;  } -static void __devexit vt586b_remove(struct pci_dev *dev) +static void vt586b_remove(struct pci_dev *dev)  {  	i2c_del_adapter(&vt586b_adapter);  	release_region(I2C_DIR, IOSPACE); @@ -158,7 +158,7 @@ static struct pci_driver vt586b_driver = {  	.name		= "vt586b_smbus",  	.id_table	= vt586b_ids,  	.probe		= vt586b_probe, -	.remove		= __devexit_p(vt586b_remove), +	.remove		= vt586b_remove,  };  module_pci_driver(vt586b_driver); diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 271c9a2b0fd..b2d90e105f4 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c @@ -320,8 +320,8 @@ static struct i2c_adapter vt596_adapter = {  	.algo		= &smbus_algorithm,  }; -static int __devinit vt596_probe(struct pci_dev *pdev, -				 const struct pci_device_id *id) +static int vt596_probe(struct pci_dev *pdev, +		       const struct pci_device_id *id)  {  	unsigned char temp;  	int error; diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index f5fa20dea90..f45c32c1ace 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c @@ -360,7 +360,7 @@ static const struct i2c_algorithm vprbrd_algorithm = {  	.functionality	= vprbrd_i2c_func,  }; -static int __devinit vprbrd_i2c_probe(struct platform_device *pdev) +static int vprbrd_i2c_probe(struct platform_device *pdev)  {  	struct vprbrd *vb = dev_get_drvdata(pdev->dev.parent);  	struct vprbrd_i2c *vb_i2c; @@ -418,7 +418,7 @@ error:  	return ret;  } -static int __devexit vprbrd_i2c_remove(struct platform_device *pdev) +static int vprbrd_i2c_remove(struct platform_device *pdev)  {  	struct vprbrd_i2c *vb_i2c = platform_get_drvdata(pdev);  	int ret; @@ -432,7 +432,7 @@ static struct platform_driver vprbrd_i2c_driver = {  	.driver.name	= "viperboard-i2c",  	.driver.owner	= THIS_MODULE,  	.probe		= vprbrd_i2c_probe, -	.remove		= __devexit_p(vprbrd_i2c_remove), +	.remove		= vprbrd_i2c_remove,  };  static int __init vprbrd_i2c_init(void) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 641d0e5e330..f042f6da0ac 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -689,7 +689,7 @@ static struct i2c_adapter xiic_adapter = {  }; -static int __devinit xiic_i2c_probe(struct platform_device *pdev) +static int xiic_i2c_probe(struct platform_device *pdev)  {  	struct xiic_i2c *i2c;  	struct xiic_i2c_platform_data *pdata; @@ -774,7 +774,7 @@ resource_missing:  	return -ENOENT;  } -static int __devexit xiic_i2c_remove(struct platform_device* pdev) +static int xiic_i2c_remove(struct platform_device *pdev)  {  	struct xiic_i2c *i2c = platform_get_drvdata(pdev);  	struct resource *res; @@ -800,7 +800,7 @@ static int __devexit xiic_i2c_remove(struct platform_device* pdev)  }  #if defined(CONFIG_OF) -static const struct of_device_id xiic_of_match[] __devinitconst = { +static const struct of_device_id xiic_of_match[] = {  	{ .compatible = "xlnx,xps-iic-2.00.a", },  	{},  }; @@ -809,7 +809,7 @@ MODULE_DEVICE_TABLE(of, xiic_of_match);  static struct platform_driver xiic_i2c_driver = {  	.probe   = xiic_i2c_probe, -	.remove  = __devexit_p(xiic_i2c_remove), +	.remove  = xiic_i2c_remove,  	.driver  = {  		.owner = THIS_MODULE,  		.name = DRIVER_NAME, diff --git a/drivers/i2c/busses/i2c-xlr.c b/drivers/i2c/busses/i2c-xlr.c index 96d3fabd888..a005265461d 100644 --- a/drivers/i2c/busses/i2c-xlr.c +++ b/drivers/i2c/busses/i2c-xlr.c @@ -214,7 +214,7 @@ static struct i2c_algorithm xlr_i2c_algo = {  	.functionality	= xlr_func,  }; -static int __devinit xlr_i2c_probe(struct platform_device *pdev) +static int xlr_i2c_probe(struct platform_device *pdev)  {  	struct xlr_i2c_private  *priv;  	struct resource *res; @@ -251,7 +251,7 @@ static int __devinit xlr_i2c_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit xlr_i2c_remove(struct platform_device *pdev) +static int xlr_i2c_remove(struct platform_device *pdev)  {  	struct xlr_i2c_private *priv; @@ -263,7 +263,7 @@ static int __devexit xlr_i2c_remove(struct platform_device *pdev)  static struct platform_driver xlr_i2c_driver = {  	.probe  = xlr_i2c_probe, -	.remove = __devexit_p(xlr_i2c_remove), +	.remove = xlr_i2c_remove,  	.driver = {  		.name   = "xlr-i2cbus",  		.owner  = THIS_MODULE, diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 08aab57337d..3862a953239 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c @@ -389,7 +389,7 @@ static const struct i2c_algorithm scx200_acb_algorithm = {  static struct scx200_acb_iface *scx200_acb_list;  static DEFINE_MUTEX(scx200_acb_list_mutex); -static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface) +static int scx200_acb_probe(struct scx200_acb_iface *iface)  {  	u8 val; @@ -424,7 +424,7 @@ static __devinit int scx200_acb_probe(struct scx200_acb_iface *iface)  	return 0;  } -static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text, +static struct scx200_acb_iface *scx200_create_iface(const char *text,  		struct device *dev, int index)  {  	struct scx200_acb_iface *iface; @@ -449,7 +449,7 @@ static __devinit struct scx200_acb_iface *scx200_create_iface(const char *text,  	return iface;  } -static int __devinit scx200_acb_create(struct scx200_acb_iface *iface) +static int scx200_acb_create(struct scx200_acb_iface *iface)  {  	struct i2c_adapter *adapter;  	int rc; @@ -480,7 +480,7 @@ static int __devinit scx200_acb_create(struct scx200_acb_iface *iface)  	return 0;  } -static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text, +static struct scx200_acb_iface *scx200_create_dev(const char *text,  		unsigned long base, int index, struct device *dev)  {  	struct scx200_acb_iface *iface; @@ -508,7 +508,7 @@ static struct scx200_acb_iface * __devinit scx200_create_dev(const char *text,  	return NULL;  } -static int __devinit scx200_probe(struct platform_device *pdev) +static int scx200_probe(struct platform_device *pdev)  {  	struct scx200_acb_iface *iface;  	struct resource *res; @@ -530,14 +530,14 @@ static int __devinit scx200_probe(struct platform_device *pdev)  	return 0;  } -static void __devexit scx200_cleanup_iface(struct scx200_acb_iface *iface) +static void scx200_cleanup_iface(struct scx200_acb_iface *iface)  {  	i2c_del_adapter(&iface->adapter);  	release_region(iface->base, 8);  	kfree(iface);  } -static int __devexit scx200_remove(struct platform_device *pdev) +static int scx200_remove(struct platform_device *pdev)  {  	struct scx200_acb_iface *iface; @@ -554,7 +554,7 @@ static struct platform_driver scx200_pci_driver = {  		.owner = THIS_MODULE,  	},  	.probe = scx200_probe, -	.remove = __devexit_p(scx200_remove), +	.remove = scx200_remove,  };  static DEFINE_PCI_DEVICE_TABLE(scx200_isa) = { diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index 3b7bc06fe8a..9f50ef04a4b 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -53,14 +53,14 @@ static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan)  	return 0;  } -static int __devinit match_gpio_chip_by_label(struct gpio_chip *chip, +static int match_gpio_chip_by_label(struct gpio_chip *chip,  					      void *data)  {  	return !strcmp(chip->label, data);  }  #ifdef CONFIG_OF -static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, +static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,  					struct platform_device *pdev)  {  	struct device_node *np = pdev->dev.of_node; @@ -125,14 +125,14 @@ static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux,  	return 0;  }  #else -static int __devinit i2c_mux_gpio_probe_dt(struct gpiomux *mux, +static int i2c_mux_gpio_probe_dt(struct gpiomux *mux,  					struct platform_device *pdev)  {  	return 0;  }  #endif -static int __devinit i2c_mux_gpio_probe(struct platform_device *pdev) +static int i2c_mux_gpio_probe(struct platform_device *pdev)  {  	struct gpiomux *mux;  	struct i2c_adapter *parent; @@ -239,7 +239,7 @@ alloc_failed:  	return ret;  } -static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev) +static int i2c_mux_gpio_remove(struct platform_device *pdev)  {  	struct gpiomux *mux = platform_get_drvdata(pdev);  	int i; @@ -256,7 +256,7 @@ static int __devexit i2c_mux_gpio_remove(struct platform_device *pdev)  	return 0;  } -static const struct of_device_id i2c_mux_gpio_of_match[] __devinitconst = { +static const struct of_device_id i2c_mux_gpio_of_match[] = {  	{ .compatible = "i2c-mux-gpio", },  	{},  }; @@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(of, i2c_mux_gpio_of_match);  static struct platform_driver i2c_mux_gpio_driver = {  	.probe	= i2c_mux_gpio_probe, -	.remove	= __devexit_p(i2c_mux_gpio_remove), +	.remove	= i2c_mux_gpio_remove,  	.driver	= {  		.owner	= THIS_MODULE,  		.name	= "i2c-mux-gpio", diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c index 7fa5b24b16d..1e44d04d1b2 100644 --- a/drivers/i2c/muxes/i2c-mux-pinctrl.c +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c @@ -129,7 +129,7 @@ static inline int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux,  }  #endif -static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) +static int i2c_mux_pinctrl_probe(struct platform_device *pdev)  {  	struct i2c_mux_pinctrl *mux;  	int (*deselect)(struct i2c_adapter *, void *, u32); @@ -241,7 +241,7 @@ err:  	return ret;  } -static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev) +static int i2c_mux_pinctrl_remove(struct platform_device *pdev)  {  	struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev);  	int i; @@ -255,7 +255,7 @@ static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev)  }  #ifdef CONFIG_OF -static const struct of_device_id i2c_mux_pinctrl_of_match[] __devinitconst = { +static const struct of_device_id i2c_mux_pinctrl_of_match[] = {  	{ .compatible = "i2c-mux-pinctrl", },  	{},  }; @@ -269,7 +269,7 @@ static struct platform_driver i2c_mux_pinctrl_driver = {  		.of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match),  	},  	.probe	= i2c_mux_pinctrl_probe, -	.remove	= __devexit_p(i2c_mux_pinctrl_remove), +	.remove	= i2c_mux_pinctrl_remove,  };  module_platform_driver(i2c_mux_pinctrl_driver); diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c index 1885a26776b..a0d931bcb37 100644 --- a/drivers/leds/leds-gpio.c +++ b/drivers/leds/leds-gpio.c @@ -127,8 +127,9 @@ static int create_gpio_led(const struct gpio_led *template,  		led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;  	ret = devm_gpio_request_one(parent, template->gpio, -			GPIOF_DIR_OUT | (led_dat->active_low ^ state), -			template->name); +				    (led_dat->active_low ^ state) ? +				    GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, +				    template->name);  	if (ret < 0)  		return ret; diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index a9f6de5b69d..2e8c0cb79c3 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -71,8 +71,6 @@  #include <media/v4l2-common.h>  #include <media/v4l2-device.h> -#include <plat/cpu.h> -  #include "isp.h"  #include "ispreg.h"  #include "ispccdc.h" diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 516a5b188ea..2bb7613ddeb 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1061,7 +1061,7 @@ int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,  	ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping);  	if (ctrl == NULL) { -		ret = -ENOENT; +		ret = -EINVAL;  		goto done;  	} @@ -1099,13 +1099,12 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain,  		return -ERESTARTSYS;  	ctrl = uvc_find_control(chain, query_menu->id, &mapping); -	if (ctrl == NULL) { -		ret = -ENOENT; +	if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) { +		ret = -EINVAL;  		goto done;  	} -	if (mapping->v4l2_type != V4L2_CTRL_TYPE_MENU || -	    query_menu->index >= mapping->menu_count) { +	if (query_menu->index >= mapping->menu_count) {  		ret = -EINVAL;  		goto done;  	} @@ -1264,7 +1263,7 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)  	ctrl = uvc_find_control(handle->chain, sev->id, &mapping);  	if (ctrl == NULL) { -		ret = -ENOENT; +		ret = -EINVAL;  		goto done;  	} @@ -1415,7 +1414,7 @@ int uvc_ctrl_get(struct uvc_video_chain *chain,  	ctrl = uvc_find_control(chain, xctrl->id, &mapping);  	if (ctrl == NULL) -		return -ENOENT; +		return -EINVAL;  	return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value);  } @@ -1432,10 +1431,8 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,  	int ret;  	ctrl = uvc_find_control(chain, xctrl->id, &mapping); -	if (ctrl == NULL) -		return -ENOENT; -	if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) -		return -EACCES; +	if (ctrl == NULL || (ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR) == 0) +		return -EINVAL;  	/* Clamp out of range values. */  	switch (mapping->v4l2_type) { diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 8e056046bc2..f2ee8c6b0d8 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -607,10 +607,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)  		ret = uvc_ctrl_get(chain, &xctrl);  		uvc_ctrl_rollback(handle); -		if (ret < 0) -			return ret == -ENOENT ? -EINVAL : ret; - -		ctrl->value = xctrl.value; +		if (ret >= 0) +			ctrl->value = xctrl.value;  		break;  	} @@ -634,7 +632,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)  		ret = uvc_ctrl_set(chain, &xctrl);  		if (ret < 0) {  			uvc_ctrl_rollback(handle); -			return ret == -ENOENT ? -EINVAL : ret; +			return ret;  		}  		ret = uvc_ctrl_commit(handle, &xctrl, 1);  		if (ret == 0) @@ -661,7 +659,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)  				uvc_ctrl_rollback(handle);  				ctrls->error_idx = ret == -ENOENT  						 ? ctrls->count : i; -				return ret == -ENOENT ? -EINVAL : ret; +				return ret;  			}  		}  		ctrls->error_idx = 0; @@ -691,7 +689,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)  				ctrls->error_idx = (ret == -ENOENT &&  						    cmd == VIDIOC_S_EXT_CTRLS)  						 ? ctrls->count : i; -				return ret == -ENOENT ? -EINVAL : ret; +				return ret;  			}  		} diff --git a/drivers/net/ethernet/marvell/mvmdio.c b/drivers/net/ethernet/marvell/mvmdio.c index 6d6002bab06..74f1c157a48 100644 --- a/drivers/net/ethernet/marvell/mvmdio.c +++ b/drivers/net/ethernet/marvell/mvmdio.c @@ -141,7 +141,7 @@ static int orion_mdio_reset(struct mii_bus *bus)  	return 0;  } -static int __devinit orion_mdio_probe(struct platform_device *pdev) +static int orion_mdio_probe(struct platform_device *pdev)  {  	struct device_node *np = pdev->dev.of_node;  	struct mii_bus *bus; @@ -197,7 +197,7 @@ static int __devinit orion_mdio_probe(struct platform_device *pdev)  	return 0;  } -static int __devexit orion_mdio_remove(struct platform_device *pdev) +static int orion_mdio_remove(struct platform_device *pdev)  {  	struct mii_bus *bus = platform_get_drvdata(pdev);  	mdiobus_unregister(bus); @@ -214,7 +214,7 @@ MODULE_DEVICE_TABLE(of, orion_mdio_match);  static struct platform_driver orion_mdio_driver = {  	.probe = orion_mdio_probe, -	.remove = __devexit_p(orion_mdio_remove), +	.remove = orion_mdio_remove,  	.driver = {  		.name = "orion-mdio",  		.of_match_table = orion_mdio_match, diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 3f8086b9f5e..b6025c305e1 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -635,7 +635,7 @@ static void mvneta_rxq_bm_disable(struct mvneta_port *pp,  /* Sets the RGMII Enable bit (RGMIIEn) in port MAC control register */ -static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable) +static void mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)  {  	u32  val; @@ -650,7 +650,7 @@ static void __devinit mvneta_gmac_rgmii_set(struct mvneta_port *pp, int enable)  }  /* Config SGMII port */ -static void __devinit mvneta_port_sgmii_config(struct mvneta_port *pp) +static void mvneta_port_sgmii_config(struct mvneta_port *pp)  {  	u32 val; @@ -2564,7 +2564,7 @@ const struct ethtool_ops mvneta_eth_tool_ops = {  };  /* Initialize hw */ -static int __devinit mvneta_init(struct mvneta_port *pp, int phy_addr) +static int mvneta_init(struct mvneta_port *pp, int phy_addr)  {  	int queue; @@ -2613,9 +2613,8 @@ static void mvneta_deinit(struct mvneta_port *pp)  }  /* platform glue : initialize decoding windows */ -static void __devinit -mvneta_conf_mbus_windows(struct mvneta_port *pp, -			 const struct mbus_dram_target_info *dram) +static void mvneta_conf_mbus_windows(struct mvneta_port *pp, +				     const struct mbus_dram_target_info *dram)  {  	u32 win_enable;  	u32 win_protect; @@ -2648,7 +2647,7 @@ mvneta_conf_mbus_windows(struct mvneta_port *pp,  }  /* Power up the port */ -static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) +static void mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)  {  	u32 val; @@ -2671,7 +2670,7 @@ static void __devinit mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)  }  /* Device initialization routine */ -static int __devinit mvneta_probe(struct platform_device *pdev) +static int mvneta_probe(struct platform_device *pdev)  {  	const struct mbus_dram_target_info *dram_target_info;  	struct device_node *dn = pdev->dev.of_node; @@ -2803,7 +2802,7 @@ err_free_netdev:  }  /* Device removal routine */ -static int __devexit mvneta_remove(struct platform_device *pdev) +static int mvneta_remove(struct platform_device *pdev)  {  	struct net_device  *dev = platform_get_drvdata(pdev);  	struct mvneta_port *pp = netdev_priv(dev); @@ -2828,7 +2827,7 @@ MODULE_DEVICE_TABLE(of, mvneta_match);  static struct platform_driver mvneta_driver = {  	.probe = mvneta_probe, -	.remove = __devexit_p(mvneta_remove), +	.remove = mvneta_remove,  	.driver = {  		.name = MVNETA_DRIVER_NAME,  		.of_match_table = mvneta_match, diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 5e62c1aeeff..463597f919f 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -247,8 +247,7 @@ static void cpts_clk_init(struct cpts *cpts)  		cpts->refclk = NULL;  		return;  	} -	clk_enable(cpts->refclk); -	cpts->freq = cpts->refclk->recalc(cpts->refclk); +	clk_prepare_enable(cpts->refclk);  }  static void cpts_clk_release(struct cpts *cpts) diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h index e1bba3a496b..fe993cdd7e2 100644 --- a/drivers/net/ethernet/ti/cpts.h +++ b/drivers/net/ethernet/ti/cpts.h @@ -120,7 +120,6 @@ struct cpts {  	struct delayed_work overflow_work;  	int phc_index;  	struct clk *refclk; -	unsigned long freq;  	struct list_head events;  	struct list_head pool;  	struct cpts_event pool_data[CPTS_MAX_EVENTS]; diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 504f7f1cad9..fbd106edbe5 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -180,7 +180,6 @@ struct tun_struct {  	int debug;  #endif  	spinlock_t lock; -	struct kmem_cache *flow_cache;  	struct hlist_head flows[TUN_NUM_FLOW_ENTRIES];  	struct timer_list flow_gc_timer;  	unsigned long ageing_time; @@ -209,8 +208,8 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,  					      struct hlist_head *head,  					      u32 rxhash, u16 queue_index)  { -	struct tun_flow_entry *e = kmem_cache_alloc(tun->flow_cache, -						    GFP_ATOMIC); +	struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); +  	if (e) {  		tun_debug(KERN_INFO, tun, "create flow: hash %u index %u\n",  			  rxhash, queue_index); @@ -223,19 +222,12 @@ static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun,  	return e;  } -static void tun_flow_free(struct rcu_head *head) -{ -	struct tun_flow_entry *e -		= container_of(head, struct tun_flow_entry, rcu); -	kmem_cache_free(e->tun->flow_cache, e); -} -  static void tun_flow_delete(struct tun_struct *tun, struct tun_flow_entry *e)  {  	tun_debug(KERN_INFO, tun, "delete flow: hash %u index %u\n",  		  e->rxhash, e->queue_index);  	hlist_del_rcu(&e->hash_link); -	call_rcu(&e->rcu, tun_flow_free); +	kfree_rcu(e, rcu);  }  static void tun_flow_flush(struct tun_struct *tun) @@ -833,12 +825,6 @@ static int tun_flow_init(struct tun_struct *tun)  {  	int i; -	tun->flow_cache = kmem_cache_create("tun_flow_cache", -					    sizeof(struct tun_flow_entry), 0, 0, -					    NULL); -	if (!tun->flow_cache) -		return -ENOMEM; -  	for (i = 0; i < TUN_NUM_FLOW_ENTRIES; i++)  		INIT_HLIST_HEAD(&tun->flows[i]); @@ -854,10 +840,6 @@ static void tun_flow_uninit(struct tun_struct *tun)  {  	del_timer_sync(&tun->flow_gc_timer);  	tun_flow_flush(tun); - -	/* Wait for completion of call_rcu()'s */ -	rcu_barrier(); -	kmem_cache_destroy(tun->flow_cache);  }  /* Initialize net device. */ diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 3b3fdf648ea..40f2cc135a4 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -505,7 +505,8 @@ static int vxlan_join_group(struct net_device *dev)  	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);  	struct sock *sk = vn->sock->sk;  	struct ip_mreqn mreq = { -		.imr_multiaddr.s_addr = vxlan->gaddr, +		.imr_multiaddr.s_addr	= vxlan->gaddr, +		.imr_ifindex		= vxlan->link,  	};  	int err; @@ -532,7 +533,8 @@ static int vxlan_leave_group(struct net_device *dev)  	int err = 0;  	struct sock *sk = vn->sock->sk;  	struct ip_mreqn mreq = { -		.imr_multiaddr.s_addr = vxlan->gaddr, +		.imr_multiaddr.s_addr	= vxlan->gaddr, +		.imr_ifindex		= vxlan->link,  	};  	/* Only leave group when last vxlan is done. */ diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c index 18b0bc51766..bb7cc90bafb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c @@ -341,7 +341,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {  	.maps[RTL_RC_HT_RATEMCS15] = DESC92_RATEMCS15,  }; -static struct pci_device_id rtl8723ae_pci_ids[] __devinitdata = { +static struct pci_device_id rtl8723ae_pci_ids[] = {  	{RTL_PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8723, rtl8723ae_hal_cfg)},  	{},  }; diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 05b78b16d20..9c6e9bb674e 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -422,77 +422,60 @@ static ssize_t sriov_numvfs_show(struct device *dev,  }  /* - * num_vfs > 0; number of vfs to enable - * num_vfs = 0; disable all vfs + * num_vfs > 0; number of VFs to enable + * num_vfs = 0; disable all VFs   *   * Note: SRIOV spec doesn't allow partial VF - *       disable, so its all or none. + *       disable, so it's all or none.   */  static ssize_t sriov_numvfs_store(struct device *dev,  				  struct device_attribute *attr,  				  const char *buf, size_t count)  {  	struct pci_dev *pdev = to_pci_dev(dev); -	int num_vfs_enabled = 0; -	int num_vfs; -	int ret = 0; -	u16 total; +	int ret; +	u16 num_vfs; -	if (kstrtoint(buf, 0, &num_vfs) < 0) -		return -EINVAL; +	ret = kstrtou16(buf, 0, &num_vfs); +	if (ret < 0) +		return ret; + +	if (num_vfs > pci_sriov_get_totalvfs(pdev)) +		return -ERANGE; + +	if (num_vfs == pdev->sriov->num_VFs) +		return count;		/* no change */  	/* is PF driver loaded w/callback */  	if (!pdev->driver || !pdev->driver->sriov_configure) { -		dev_info(&pdev->dev, -			 "Driver doesn't support SRIOV configuration via sysfs\n"); +		dev_info(&pdev->dev, "Driver doesn't support SRIOV configuration via sysfs\n");  		return -ENOSYS;  	} -	/* if enabling vf's ... */ -	total = pci_sriov_get_totalvfs(pdev); -	/* Requested VFs to enable < totalvfs and none enabled already */ -	if ((num_vfs > 0) && (num_vfs <= total)) { -		if (pdev->sriov->num_VFs == 0) { -			num_vfs_enabled = -				pdev->driver->sriov_configure(pdev, num_vfs); -			if ((num_vfs_enabled >= 0) && -			    (num_vfs_enabled != num_vfs)) { -				dev_warn(&pdev->dev, -					 "Only %d VFs enabled\n", -					 num_vfs_enabled); -				return count; -			} else if (num_vfs_enabled < 0) -				/* error code from driver callback */ -				return num_vfs_enabled; -		} else if (num_vfs == pdev->sriov->num_VFs) { -			dev_warn(&pdev->dev, -				 "%d VFs already enabled; no enable action taken\n", -				 num_vfs); -			return count; -		} else { -			dev_warn(&pdev->dev, -				 "%d VFs already enabled. Disable before enabling %d VFs\n", -				 pdev->sriov->num_VFs, num_vfs); -			return -EINVAL; -		} +	if (num_vfs == 0) { +		/* disable VFs */ +		ret = pdev->driver->sriov_configure(pdev, 0); +		if (ret < 0) +			return ret; +		return count;  	} -	/* disable vfs */ -	if (num_vfs == 0) { -		if (pdev->sriov->num_VFs != 0) { -			ret = pdev->driver->sriov_configure(pdev, 0); -			return ret ? ret : count; -		} else { -			dev_warn(&pdev->dev, -				 "All VFs disabled; no disable action taken\n"); -			return count; -		} +	/* enable VFs */ +	if (pdev->sriov->num_VFs) { +		dev_warn(&pdev->dev, "%d VFs already enabled. Disable before enabling %d VFs\n", +			 pdev->sriov->num_VFs, num_vfs); +		return -EBUSY;  	} -	dev_err(&pdev->dev, -		"Invalid value for number of VFs to enable: %d\n", num_vfs); +	ret = pdev->driver->sriov_configure(pdev, num_vfs); +	if (ret < 0) +		return ret; -	return -EINVAL; +	if (ret != num_vfs) +		dev_warn(&pdev->dev, "%d VFs requested; only %d enabled\n", +			 num_vfs, ret); + +	return count;  }  static struct device_attribute sriov_totalvfs_attr = __ATTR_RO(sriov_totalvfs); diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index d4824cb78b4..08c243ab034 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c @@ -134,10 +134,28 @@ static int pcie_port_runtime_resume(struct device *dev)  	return 0;  } +static int pci_dev_pme_poll(struct pci_dev *pdev, void *data) +{ +	bool *pme_poll = data; + +	if (pdev->pme_poll) +		*pme_poll = true; +	return 0; +} +  static int pcie_port_runtime_idle(struct device *dev)  { +	struct pci_dev *pdev = to_pci_dev(dev); +	bool pme_poll = false; + +	/* +	 * If any subordinate device needs pme poll, we should keep +	 * the port in D0, because we need port in D0 to poll it. +	 */ +	pci_walk_bus(pdev->subordinate, pci_dev_pme_poll, &pme_poll);  	/* Delay for a short while to prevent too frequent suspend/resume */ -	pm_schedule_suspend(dev, 10); +	if (!pme_poll) +		pm_schedule_suspend(dev, 10);  	return -EBUSY;  }  #else diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 8f7a6344e79..0369fb6fc1d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2725,7 +2725,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)  	if (PCI_FUNC(dev->devfn))  		return;  	/* -	 * RICOH 0xe823 SD/MMC card reader fails to recognize +	 * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize  	 * certain types of SD/MMC cards. Lowering the SD base  	 * clock frequency from 200Mhz to 50Mhz fixes this issue.  	 * @@ -2736,7 +2736,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)  	 * 0xf9  - Key register for 0x150  	 * 0xfc  - key register for 0xe1  	 */ -	if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { +	if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 || +	    dev->device == PCI_DEVICE_ID_RICOH_R5CE823) {  		pci_write_config_byte(dev, 0xf9, 0xfc);  		pci_write_config_byte(dev, 0x150, 0x10);  		pci_write_config_byte(dev, 0xf9, 0x00); @@ -2763,6 +2764,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev)  }  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832);  DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); +DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832);  DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);  DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832);  #endif /*CONFIG_MMC_RICOH_MMC*/ diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index a17d0841172..6b2238bb6a8 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c @@ -27,8 +27,6 @@  #include <linux/pm_runtime.h>  #include <linux/power/smartreflex.h> -#include <plat/cpu.h> -  #define SMARTREFLEX_NAME_LEN	16  #define NVALUE_NAME_LEN		40  #define SR_DISABLE_TIMEOUT	200 diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c index 709ea1aefeb..f5ad10546fc 100644 --- a/drivers/watchdog/da9055_wdt.c +++ b/drivers/watchdog/da9055_wdt.c @@ -72,20 +72,21 @@ static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,  					DA9055_TWDSCALE_MASK,  					da9055_wdt_maps[i].reg_val <<  					DA9055_TWDSCALE_SHIFT); -	if (ret < 0) +	if (ret < 0) {  		dev_err(da9055->dev,  			"Failed to update timescale bit, %d\n", ret); +		return ret; +	}  	wdt_dev->timeout = timeout; -	return ret; +	return 0;  }  static int da9055_wdt_ping(struct watchdog_device *wdt_dev)  {  	struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);  	struct da9055 *da9055 = driver_data->da9055; -	int ret;  	/*  	 * We have a minimum time for watchdog window called TWDMIN. A write @@ -94,18 +95,12 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)  	mdelay(DA9055_TWDMIN);  	/* Reset the watchdog timer */ -	ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E, -				DA9055_WATCHDOG_MASK, 1); - -	return ret; +	return da9055_reg_update(da9055, DA9055_REG_CONTROL_E, +				 DA9055_WATCHDOG_MASK, 1);  }  static void da9055_wdt_release_resources(struct kref *r)  { -	struct da9055_wdt_data *driver_data = -		container_of(r, struct da9055_wdt_data, kref); - -	kfree(driver_data);  }  static void da9055_wdt_ref(struct watchdog_device *wdt_dev) diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 34ed61ea02b..b0e541d022e 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -296,7 +296,6 @@ static int omap_wdt_remove(struct platform_device *pdev)  {  	struct watchdog_device *wdog = platform_get_drvdata(pdev);  	struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog); -	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);  	pm_runtime_disable(wdev->dev);  	watchdog_unregister_device(wdog); diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c index 81918cf8993..0f03106f751 100644 --- a/drivers/watchdog/twl4030_wdt.c +++ b/drivers/watchdog/twl4030_wdt.c @@ -131,14 +131,21 @@ static int twl4030_wdt_resume(struct platform_device *pdev)  #define twl4030_wdt_resume         NULL  #endif +static const struct of_device_id twl_wdt_of_match[] = { +	{ .compatible = "ti,twl4030-wdt", }, +	{ }, +}; +MODULE_DEVICE_TABLE(of, twl_wdt_of_match); +  static struct platform_driver twl4030_wdt_driver = {  	.probe		= twl4030_wdt_probe,  	.remove		= twl4030_wdt_remove,  	.suspend	= twl4030_wdt_suspend,  	.resume		= twl4030_wdt_resume,  	.driver		= { -		.owner	= THIS_MODULE, -		.name	= "twl4030_wdt", +		.owner		= THIS_MODULE, +		.name		= "twl4030_wdt", +		.of_match_table	= twl_wdt_of_match,  	},  }; diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index ea993128155..a7b0c2dfb3d 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = {   * @src: Source location for the filename to encode   * @src_size: Size of the source in bytes   */ -void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, +static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size,  				  unsigned char *src, size_t src_size)  {  	size_t num_blocks; diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 809e67d05ca..f1ea610362c 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c @@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void)  void ecryptfs_destroy_kthread(void)  { -	struct ecryptfs_open_req *req; +	struct ecryptfs_open_req *req, *tmp;  	mutex_lock(&ecryptfs_kthread_ctl.mux);  	ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; -	list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, -			    kthread_ctl_list) { +	list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list, +				 kthread_ctl_list) {  		list_del(&req->kthread_ctl_list);  		*req->lower_file = ERR_PTR(-EIO);  		complete(&req->done); diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index bd1d57f98f7..564a1fa34b9 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c @@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file,  			if (prev_page_end_size  			    >= i_size_read(page->mapping->host)) {  				zero_user(page, 0, PAGE_CACHE_SIZE); -			} else { +				SetPageUptodate(page); +			} else if (len < PAGE_CACHE_SIZE) {  				rc = ecryptfs_decrypt_page(page);  				if (rc) {  					printk(KERN_ERR "%s: Error decrypting " @@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file,  					ClearPageUptodate(page);  					goto out;  				} +				SetPageUptodate(page);  			} -			SetPageUptodate(page);  		}  	}  	/* If creating a page or more of holes, zero them out via truncate. @@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file,  		}  		goto out;  	} +	if (!PageUptodate(page)) { +		if (copied < PAGE_CACHE_SIZE) { +			rc = 0; +			goto out; +		} +		SetPageUptodate(page); +	}  	/* Fills in zeros if 'to' goes beyond inode size */  	rc = fill_zeros_to_end_of_page(page, to);  	if (rc) { diff --git a/fs/eventpoll.c b/fs/eventpoll.c index be56b21435f..9fec1836057 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1313,7 +1313,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even  	 * otherwise we might miss an event that happens between the  	 * f_op->poll() call and the new event set registering.  	 */ -	epi->event.events = event->events; +	epi->event.events = event->events; /* need barrier below */  	pt._key = event->events;  	epi->event.data = event->data; /* protected by mtx */  	if (epi->event.events & EPOLLWAKEUP) { @@ -1324,6 +1324,26 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even  	}  	/* +	 * The following barrier has two effects: +	 * +	 * 1) Flush epi changes above to other CPUs.  This ensures +	 *    we do not miss events from ep_poll_callback if an +	 *    event occurs immediately after we call f_op->poll(). +	 *    We need this because we did not take ep->lock while +	 *    changing epi above (but ep_poll_callback does take +	 *    ep->lock). +	 * +	 * 2) We also need to ensure we do not miss _past_ events +	 *    when calling f_op->poll().  This barrier also +	 *    pairs with the barrier in wq_has_sleeper (see +	 *    comments for wq_has_sleeper). +	 * +	 * This barrier will now guarantee ep_poll_callback or f_op->poll +	 * (or both) will notice the readiness of an item. +	 */ +	smp_mb(); + +	/*  	 * Get current event bits. We can safely use the file* here because  	 * its usage count has been increased by the caller of this function.  	 */ diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 26af22832a8..5ae1674ec12 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -2226,13 +2226,14 @@ errout:   * removes index from the index block.   */  static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, -			struct ext4_ext_path *path) +			struct ext4_ext_path *path, int depth)  {  	int err;  	ext4_fsblk_t leaf;  	/* free index block */ -	path--; +	depth--; +	path = path + depth;  	leaf = ext4_idx_pblock(path->p_idx);  	if (unlikely(path->p_hdr->eh_entries == 0)) {  		EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); @@ -2257,6 +2258,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,  	ext4_free_blocks(handle, inode, NULL, leaf, 1,  			 EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); + +	while (--depth >= 0) { +		if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) +			break; +		path--; +		err = ext4_ext_get_access(handle, inode, path); +		if (err) +			break; +		path->p_idx->ei_block = (path+1)->p_idx->ei_block; +		err = ext4_ext_dirty(handle, inode, path); +		if (err) +			break; +	}  	return err;  } @@ -2599,7 +2613,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,  	/* if this leaf is free, then we should  	 * remove it from index block above */  	if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) -		err = ext4_ext_rm_idx(handle, inode, path + depth); +		err = ext4_ext_rm_idx(handle, inode, path, depth);  out:  	return err; @@ -2802,7 +2816,7 @@ again:  				/* index is empty, remove it;  				 * handle must be already prepared by the  				 * truncatei_leaf() */ -				err = ext4_ext_rm_idx(handle, inode, path + i); +				err = ext4_ext_rm_idx(handle, inode, path, i);  			}  			/* root level has p_bh == NULL, brelse() eats this */  			brelse(path[i].p_bh); diff --git a/fs/ext4/file.c b/fs/ext4/file.c index d07c27ca594..405565a6227 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -108,14 +108,6 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,  	/* Unaligned direct AIO must be serialized; see comment above */  	if (unaligned_aio) { -		static unsigned long unaligned_warn_time; - -		/* Warn about this once per day */ -		if (printk_timed_ratelimit(&unaligned_warn_time, 60*60*24*HZ)) -			ext4_msg(inode->i_sb, KERN_WARNING, -				 "Unaligned AIO/DIO on inode %ld by %s; " -				 "performance will be poor.", -				 inode->i_ino, current->comm);  		mutex_lock(ext4_aio_mutex(inode));  		ext4_unwritten_wait(inode);  	} diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index dfbc1fe9667..3278e64e57b 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -109,8 +109,6 @@ static int __sync_inode(struct inode *inode, int datasync)   *   * What we do is just kick off a commit and wait on it.  This will snapshot the   * inode to disk. - * - * i_mutex lock is held when entering and exiting this function   */  int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index cb1c1ab2720..cbfe13bf5b2 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2880,8 +2880,6 @@ static void ext4_invalidatepage_free_endio(struct page *page, unsigned long offs  static void ext4_invalidatepage(struct page *page, unsigned long offset)  { -	journal_t *journal = EXT4_JOURNAL(page->mapping->host); -  	trace_ext4_invalidatepage(page, offset);  	/* @@ -2889,16 +2887,34 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)  	 */  	if (ext4_should_dioread_nolock(page->mapping->host))  		ext4_invalidatepage_free_endio(page, offset); + +	/* No journalling happens on data buffers when this function is used */ +	WARN_ON(page_has_buffers(page) && buffer_jbd(page_buffers(page))); + +	block_invalidatepage(page, offset); +} + +static int __ext4_journalled_invalidatepage(struct page *page, +					    unsigned long offset) +{ +	journal_t *journal = EXT4_JOURNAL(page->mapping->host); + +	trace_ext4_journalled_invalidatepage(page, offset); +  	/*  	 * If it's a full truncate we just forget about the pending dirtying  	 */  	if (offset == 0)  		ClearPageChecked(page); -	if (journal) -		jbd2_journal_invalidatepage(journal, page, offset); -	else -		block_invalidatepage(page, offset); +	return jbd2_journal_invalidatepage(journal, page, offset); +} + +/* Wrapper for aops... */ +static void ext4_journalled_invalidatepage(struct page *page, +					   unsigned long offset) +{ +	WARN_ON(__ext4_journalled_invalidatepage(page, offset) < 0);  }  static int ext4_releasepage(struct page *page, gfp_t wait) @@ -3264,7 +3280,7 @@ static const struct address_space_operations ext4_journalled_aops = {  	.write_end		= ext4_journalled_write_end,  	.set_page_dirty		= ext4_journalled_set_page_dirty,  	.bmap			= ext4_bmap, -	.invalidatepage		= ext4_invalidatepage, +	.invalidatepage		= ext4_journalled_invalidatepage,  	.releasepage		= ext4_releasepage,  	.direct_IO		= ext4_direct_IO,  	.is_partially_uptodate  = block_is_partially_uptodate, @@ -4305,6 +4321,47 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc)  }  /* + * In data=journal mode ext4_journalled_invalidatepage() may fail to invalidate + * buffers that are attached to a page stradding i_size and are undergoing + * commit. In that case we have to wait for commit to finish and try again. + */ +static void ext4_wait_for_tail_page_commit(struct inode *inode) +{ +	struct page *page; +	unsigned offset; +	journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; +	tid_t commit_tid = 0; +	int ret; + +	offset = inode->i_size & (PAGE_CACHE_SIZE - 1); +	/* +	 * All buffers in the last page remain valid? Then there's nothing to +	 * do. We do the check mainly to optimize the common PAGE_CACHE_SIZE == +	 * blocksize case +	 */ +	if (offset > PAGE_CACHE_SIZE - (1 << inode->i_blkbits)) +		return; +	while (1) { +		page = find_lock_page(inode->i_mapping, +				      inode->i_size >> PAGE_CACHE_SHIFT); +		if (!page) +			return; +		ret = __ext4_journalled_invalidatepage(page, offset); +		unlock_page(page); +		page_cache_release(page); +		if (ret != -EBUSY) +			return; +		commit_tid = 0; +		read_lock(&journal->j_state_lock); +		if (journal->j_committing_transaction) +			commit_tid = journal->j_committing_transaction->t_tid; +		read_unlock(&journal->j_state_lock); +		if (commit_tid) +			jbd2_log_wait_commit(journal, commit_tid); +	} +} + +/*   * ext4_setattr()   *   * Called from notify_change. @@ -4417,16 +4474,28 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)  	}  	if (attr->ia_valid & ATTR_SIZE) { -		if (attr->ia_size != i_size_read(inode)) { -			truncate_setsize(inode, attr->ia_size); -			/* Inode size will be reduced, wait for dio in flight. -			 * Temporarily disable dioread_nolock to prevent -			 * livelock. */ +		if (attr->ia_size != inode->i_size) { +			loff_t oldsize = inode->i_size; + +			i_size_write(inode, attr->ia_size); +			/* +			 * Blocks are going to be removed from the inode. Wait +			 * for dio in flight.  Temporarily disable +			 * dioread_nolock to prevent livelock. +			 */  			if (orphan) { -				ext4_inode_block_unlocked_dio(inode); -				inode_dio_wait(inode); -				ext4_inode_resume_unlocked_dio(inode); +				if (!ext4_should_journal_data(inode)) { +					ext4_inode_block_unlocked_dio(inode); +					inode_dio_wait(inode); +					ext4_inode_resume_unlocked_dio(inode); +				} else +					ext4_wait_for_tail_page_commit(inode);  			} +			/* +			 * Truncate pagecache after we've waited for commit +			 * in data=journal mode to make pages freeable. +			 */ +			truncate_pagecache(inode, oldsize, inode->i_size);  		}  		ext4_truncate(inode);  	} diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index cac44828233..8990165346e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2648,7 +2648,8 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode)  	struct ext4_iloc iloc;  	int err = 0; -	if (!EXT4_SB(inode->i_sb)->s_journal) +	if ((!EXT4_SB(inode->i_sb)->s_journal) && +	    !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS))  		return 0;  	mutex_lock(&EXT4_SB(inode->i_sb)->s_orphan_lock); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 3cdb0a2fc64..3d4fb81bacd 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1645,9 +1645,7 @@ static int parse_options(char *options, struct super_block *sb,  			 unsigned int *journal_ioprio,  			 int is_remount)  { -#ifdef CONFIG_QUOTA  	struct ext4_sb_info *sbi = EXT4_SB(sb); -#endif  	char *p;  	substring_t args[MAX_OPT_ARGS];  	int token; @@ -1696,6 +1694,16 @@ static int parse_options(char *options, struct super_block *sb,  		}  	}  #endif +	if (test_opt(sb, DIOREAD_NOLOCK)) { +		int blocksize = +			BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); + +		if (blocksize < PAGE_CACHE_SIZE) { +			ext4_msg(sb, KERN_ERR, "can't mount with " +				 "dioread_nolock if block size != PAGE_SIZE"); +			return 0; +		} +	}  	return 1;  } @@ -2212,7 +2220,9 @@ static void ext4_orphan_cleanup(struct super_block *sb,  				__func__, inode->i_ino, inode->i_size);  			jbd_debug(2, "truncating inode %lu to %lld bytes\n",  				  inode->i_ino, inode->i_size); +			mutex_lock(&inode->i_mutex);  			ext4_truncate(inode); +			mutex_unlock(&inode->i_mutex);  			nr_truncates++;  		} else {  			ext4_msg(sb, KERN_DEBUG, @@ -3223,6 +3233,10 @@ int ext4_calculate_overhead(struct super_block *sb)  			memset(buf, 0, PAGE_SIZE);  		cond_resched();  	} +	/* Add the journal blocks as well */ +	if (sbi->s_journal) +		overhead += EXT4_B2C(sbi, sbi->s_journal->j_maxlen); +  	sbi->s_overhead = overhead;  	smp_wmb();  	free_page((unsigned long) buf); @@ -3436,15 +3450,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)  			clear_opt(sb, DELALLOC);  	} -	blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); -	if (test_opt(sb, DIOREAD_NOLOCK)) { -		if (blocksize < PAGE_SIZE) { -			ext4_msg(sb, KERN_ERR, "can't mount with " -				 "dioread_nolock if block size != PAGE_SIZE"); -			goto failed_mount; -		} -	} -  	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |  		(test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); @@ -3486,6 +3491,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)  	if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY)))  		goto failed_mount; +	blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size);  	if (blocksize < EXT4_MIN_BLOCK_SIZE ||  	    blocksize > EXT4_MAX_BLOCK_SIZE) {  		ext4_msg(sb, KERN_ERR, @@ -4725,7 +4731,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)  	}  	ext4_setup_system_zone(sb); -	if (sbi->s_journal == NULL) +	if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY))  		ext4_commit_super(sb, 1);  #ifdef CONFIG_QUOTA diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index fed74d193ff..e95b94945d5 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c @@ -82,7 +82,6 @@ static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size)  		case ACL_GROUP_OBJ:  		case ACL_MASK:  		case ACL_OTHER: -			acl->a_entries[i].e_id = ACL_UNDEFINED_ID;  			entry = (struct f2fs_acl_entry *)((char *)entry +  					sizeof(struct f2fs_acl_entry_short));  			break; diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 42f6615af0a..df9f29760ef 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -209,7 +209,8 @@ repeat:  		if (!new_transaction)  			goto alloc_transaction;  		write_lock(&journal->j_state_lock); -		if (!journal->j_running_transaction) { +		if (!journal->j_running_transaction && +		    !journal->j_barrier_count) {  			jbd2_get_transaction(journal, new_transaction);  			new_transaction = NULL;  		} @@ -1839,7 +1840,6 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,  	BUFFER_TRACE(bh, "entry"); -retry:  	/*  	 * It is safe to proceed here without the j_list_lock because the  	 * buffers cannot be stolen by try_to_free_buffers as long as we are @@ -1934,14 +1934,11 @@ retry:  		 * for commit and try again.  		 */  		if (partial_page) { -			tid_t tid = journal->j_committing_transaction->t_tid; -  			jbd2_journal_put_journal_head(jh);  			spin_unlock(&journal->j_list_lock);  			jbd_unlock_bh_state(bh);  			write_unlock(&journal->j_state_lock); -			jbd2_log_wait_commit(journal, tid); -			goto retry; +			return -EBUSY;  		}  		/*  		 * OK, buffer won't be reachable after truncate. We just set @@ -2002,21 +1999,23 @@ zap_buffer_unlocked:   * @page:    page to flush   * @offset:  length of page to invalidate.   * - * Reap page buffers containing data after offset in page. - * + * Reap page buffers containing data after offset in page. Can return -EBUSY + * if buffers are part of the committing transaction and the page is straddling + * i_size. Caller then has to wait for current commit and try again.   */ -void jbd2_journal_invalidatepage(journal_t *journal, -		      struct page *page, -		      unsigned long offset) +int jbd2_journal_invalidatepage(journal_t *journal, +				struct page *page, +				unsigned long offset)  {  	struct buffer_head *head, *bh, *next;  	unsigned int curr_off = 0;  	int may_free = 1; +	int ret = 0;  	if (!PageLocked(page))  		BUG();  	if (!page_has_buffers(page)) -		return; +		return 0;  	/* We will potentially be playing with lists other than just the  	 * data lists (especially for journaled data mode), so be @@ -2030,9 +2029,11 @@ void jbd2_journal_invalidatepage(journal_t *journal,  		if (offset <= curr_off) {  			/* This block is wholly outside the truncation point */  			lock_buffer(bh); -			may_free &= journal_unmap_buffer(journal, bh, -							 offset > 0); +			ret = journal_unmap_buffer(journal, bh, offset > 0);  			unlock_buffer(bh); +			if (ret < 0) +				return ret; +			may_free &= ret;  		}  		curr_off = next_off;  		bh = next; @@ -2043,6 +2044,7 @@ void jbd2_journal_invalidatepage(journal_t *journal,  		if (may_free && try_to_free_buffers(page))  			J_ASSERT(!page_has_buffers(page));  	} +	return 0;  }  /* diff --git a/fs/proc/generic.c b/fs/proc/generic.c index e064f562b1f..76ddae83daa 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -352,18 +352,18 @@ retry:  	if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))  		return -ENOMEM; -	spin_lock_bh(&proc_inum_lock); +	spin_lock_irq(&proc_inum_lock);  	error = ida_get_new(&proc_inum_ida, &i); -	spin_unlock_bh(&proc_inum_lock); +	spin_unlock_irq(&proc_inum_lock);  	if (error == -EAGAIN)  		goto retry;  	else if (error)  		return error;  	if (i > UINT_MAX - PROC_DYNAMIC_FIRST) { -		spin_lock_bh(&proc_inum_lock); +		spin_lock_irq(&proc_inum_lock);  		ida_remove(&proc_inum_ida, i); -		spin_unlock_bh(&proc_inum_lock); +		spin_unlock_irq(&proc_inum_lock);  		return -ENOSPC;  	}  	*inum = PROC_DYNAMIC_FIRST + i; @@ -372,9 +372,10 @@ retry:  void proc_free_inum(unsigned int inum)  { -	spin_lock_bh(&proc_inum_lock); +	unsigned long flags; +	spin_lock_irqsave(&proc_inum_lock, flags);  	ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST); -	spin_unlock_bh(&proc_inum_lock); +	spin_unlock_irqrestore(&proc_inum_lock, flags);  }  static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 448455b7fd9..ca5ce7f9f80 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1278,7 +1278,7 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)  	walk.mm = mm;  	pol = get_vma_policy(task, vma, vma->vm_start); -	mpol_to_str(buffer, sizeof(buffer), pol, 0); +	mpol_to_str(buffer, sizeof(buffer), pol);  	mpol_cond_put(pol);  	seq_printf(m, "%08lx %s", vma->vm_start, buffer); diff --git a/include/Kbuild b/include/Kbuild index 83256b64166..1dfd33e8d43 100644 --- a/include/Kbuild +++ b/include/Kbuild @@ -1,8 +1,5 @@  # Top-level Makefile calls into asm-$(ARCH)  # List only non-arch directories below -header-y += linux/ -header-y += sound/ -header-y += rdma/  header-y += video/  header-y += scsi/ diff --git a/include/drm/drm_mm.h b/include/drm/drm_mm.h index 06d7f798a08..0f4a366f6fa 100644 --- a/include/drm/drm_mm.h +++ b/include/drm/drm_mm.h @@ -158,12 +158,29 @@ static inline struct drm_mm_node *drm_mm_get_block_atomic_range(  	return drm_mm_get_block_range_generic(parent, size, alignment, 0,  						start, end, 1);  } -extern int drm_mm_insert_node(struct drm_mm *mm, struct drm_mm_node *node, -			      unsigned long size, unsigned alignment); + +extern int drm_mm_insert_node(struct drm_mm *mm, +			      struct drm_mm_node *node, +			      unsigned long size, +			      unsigned alignment);  extern int drm_mm_insert_node_in_range(struct drm_mm *mm,  				       struct drm_mm_node *node, -				       unsigned long size, unsigned alignment, -				       unsigned long start, unsigned long end); +				       unsigned long size, +				       unsigned alignment, +				       unsigned long start, +				       unsigned long end); +extern int drm_mm_insert_node_generic(struct drm_mm *mm, +				      struct drm_mm_node *node, +				      unsigned long size, +				      unsigned alignment, +				      unsigned long color); +extern int drm_mm_insert_node_in_range_generic(struct drm_mm *mm, +				       struct drm_mm_node *node, +				       unsigned long size, +				       unsigned alignment, +				       unsigned long color, +				       unsigned long start, +				       unsigned long end);  extern void drm_mm_put_block(struct drm_mm_node *cur);  extern void drm_mm_remove_node(struct drm_mm_node *node);  extern void drm_mm_replace_node(struct drm_mm_node *old, struct drm_mm_node *new); diff --git a/include/linux/Kbuild b/include/linux/Kbuild deleted file mode 100644 index 7fe2dae251e..00000000000 --- a/include/linux/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -header-y += dvb/ -header-y += hdlc/ -header-y += hsi/ -header-y += raid/ -header-y += usb/ diff --git a/include/linux/hdlc/Kbuild b/include/linux/hdlc/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/linux/hdlc/Kbuild +++ /dev/null diff --git a/include/linux/hsi/Kbuild b/include/linux/hsi/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/linux/hsi/Kbuild +++ /dev/null diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 1be23d9fdac..e30b6634694 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -1098,7 +1098,7 @@ void		 jbd2_journal_set_triggers(struct buffer_head *,  extern int	 jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);  extern int	 jbd2_journal_forget (handle_t *, struct buffer_head *);  extern void	 journal_sync_buffer (struct buffer_head *); -extern void	 jbd2_journal_invalidatepage(journal_t *, +extern int	 jbd2_journal_invalidatepage(journal_t *,  				struct page *, unsigned long);  extern int	 jbd2_journal_try_to_free_buffers(journal_t *, struct page *, gfp_t);  extern int	 jbd2_journal_stop(handle_t *); diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 9adc270de7e..0d7df39a588 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -123,7 +123,7 @@ struct sp_node {  struct shared_policy {  	struct rb_root root; -	struct mutex mutex; +	spinlock_t lock;  };  void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol); @@ -165,11 +165,10 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,  #ifdef CONFIG_TMPFS -extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context); +extern int mpol_parse_str(char *str, struct mempolicy **mpol);  #endif -extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, -			int no_context); +extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);  /* Check if a vma is migratable */  static inline int vma_migratable(struct vm_area_struct *vma) @@ -296,15 +295,13 @@ static inline void check_highest_zone(int k)  }  #ifdef CONFIG_TMPFS -static inline int mpol_parse_str(char *str, struct mempolicy **mpol, -				int no_context) +static inline int mpol_parse_str(char *str, struct mempolicy **mpol)  {  	return 1;	/* error */  }  #endif -static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, -				int no_context) +static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)  {  	return 0;  } diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 02e0f6b156c..c599e4782d4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1576,7 +1576,7 @@ extern int call_netdevice_notifiers(unsigned long val, struct net_device *dev);  extern rwlock_t				dev_base_lock;		/* Device list lock */ -extern seqlock_t	devnet_rename_seq;	/* Device rename lock */ +extern seqcount_t	devnet_rename_seq;	/* Device rename seq */  #define for_each_netdev(net, d)		\ diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index b5d13841604..70473da47b3 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -362,7 +362,7 @@ static inline void ClearPageCompound(struct page *page)   * pages on the LRU and/or pagecache.   */  TESTPAGEFLAG(Compound, compound) -__PAGEFLAG(Head, compound) +__SETPAGEFLAG(Head, compound)  __CLEARPAGEFLAG(Head, compound)  /*   * PG_reclaim is used in combination with PG_compound to mark the @@ -374,8 +374,14 @@ __PAGEFLAG(Head, compound)   * PG_compound & PG_reclaim	=> Tail page   * PG_compound & ~PG_reclaim	=> Head page   */ +#define PG_head_mask ((1L << PG_compound))  #define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) +static inline int PageHead(struct page *page) +{ +	return ((page->flags & PG_head_tail_mask) == PG_head_mask); +} +  static inline int PageTail(struct page *page)  {  	return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask); diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 0f8447376dd..0eb65796bcb 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -1568,6 +1568,7 @@  #define PCI_DEVICE_ID_RICOH_RL5C476	0x0476  #define PCI_DEVICE_ID_RICOH_RL5C478	0x0478  #define PCI_DEVICE_ID_RICOH_R5C822	0x0822 +#define PCI_DEVICE_ID_RICOH_R5CE822	0xe822  #define PCI_DEVICE_ID_RICOH_R5CE823	0xe823  #define PCI_DEVICE_ID_RICOH_R5C832	0x0832  #define PCI_DEVICE_ID_RICOH_R5C843	0x0843 diff --git a/include/linux/pid.h b/include/linux/pid.h index b152d44fb18..2381c973d89 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -121,6 +121,7 @@ int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);  extern struct pid *alloc_pid(struct pid_namespace *ns);  extern void free_pid(struct pid *pid); +extern void disable_pid_allocation(struct pid_namespace *ns);  /*   * ns_of_pid() returns the pid namespace in which the specified pid was diff --git a/include/linux/pid_namespace.h b/include/linux/pid_namespace.h index bf285999273..215e5e3dda1 100644 --- a/include/linux/pid_namespace.h +++ b/include/linux/pid_namespace.h @@ -21,7 +21,7 @@ struct pid_namespace {  	struct kref kref;  	struct pidmap pidmap[PIDMAP_ENTRIES];  	int last_pid; -	int nr_hashed; +	unsigned int nr_hashed;  	struct task_struct *child_reaper;  	struct kmem_cache *pid_cachep;  	unsigned int level; @@ -42,6 +42,8 @@ struct pid_namespace {  extern struct pid_namespace init_pid_ns; +#define PIDNS_HASH_ADDING (1U << 31) +  #ifdef CONFIG_PID_NS  static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)  { diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/linux/raid/Kbuild +++ /dev/null diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/linux/usb/Kbuild +++ /dev/null diff --git a/include/net/sock.h b/include/net/sock.h index 93a6745bfdb..182ca99405a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -367,7 +367,7 @@ struct sock {  	unsigned short		sk_ack_backlog;  	unsigned short		sk_max_ack_backlog;  	__u32			sk_priority; -#ifdef CONFIG_CGROUPS +#if IS_ENABLED(CONFIG_NETPRIO_CGROUP)  	__u32			sk_cgrp_prioidx;  #endif  	struct pid		*sk_peer_pid; diff --git a/include/rdma/Kbuild b/include/rdma/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/rdma/Kbuild +++ /dev/null diff --git a/include/sound/Kbuild b/include/sound/Kbuild deleted file mode 100644 index e69de29bb2d..00000000000 --- a/include/sound/Kbuild +++ /dev/null diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index f6372b01136..7e8c36bc708 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h @@ -451,7 +451,7 @@ DEFINE_EVENT(ext4__page_op, ext4_releasepage,  	TP_ARGS(page)  ); -TRACE_EVENT(ext4_invalidatepage, +DECLARE_EVENT_CLASS(ext4_invalidatepage_op,  	TP_PROTO(struct page *page, unsigned long offset),  	TP_ARGS(page, offset), @@ -477,6 +477,18 @@ TRACE_EVENT(ext4_invalidatepage,  		  (unsigned long) __entry->index, __entry->offset)  ); +DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage, +	TP_PROTO(struct page *page, unsigned long offset), + +	TP_ARGS(page, offset) +); + +DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage, +	TP_PROTO(struct page *page, unsigned long offset), + +	TP_ARGS(page, offset) +); +  TRACE_EVENT(ext4_discard_blocks,  	TP_PROTO(struct super_block *sb, unsigned long long blk,  			unsigned long long count), diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index b746a3cf5fa..c4d2e9c7400 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -307,6 +307,7 @@ typedef struct drm_i915_irq_wait {  #define I915_PARAM_HAS_PRIME_VMAP_FLUSH	 21  #define I915_PARAM_RSVD_FOR_FUTURE_USE	 22  #define I915_PARAM_HAS_SECURE_BATCHES	 23 +#define I915_PARAM_HAS_PINNED_BATCHES	 24  typedef struct drm_i915_getparam {  	int param; @@ -677,6 +678,15 @@ struct drm_i915_gem_execbuffer2 {   */  #define I915_EXEC_SECURE		(1<<9) +/** Inform the kernel that the batch is and will always be pinned. This + * negates the requirement for a workaround to be performed to avoid + * an incoherent CS (such as can be found on 830/845). If this flag is + * not passed, the kernel will endeavour to make sure the batch is + * coherent with the CS before execution. If this flag is passed, + * userspace assumes the responsibility for ensuring the same. + */ +#define I915_EXEC_IS_PINNED		(1<<10) +  #define I915_EXEC_CONTEXT_ID_MASK	(0xffffffff)  #define i915_execbuffer2_set_context_id(eb2, context) \  	(eb2).rsvd1 = context & I915_EXEC_CONTEXT_ID_MASK diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 6b7b6f1e2fd..ebfadc56d1b 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -458,6 +458,8 @@  #define  PCI_EXP_DEVSTA_TRPND	0x20	/* Transactions Pending */  #define PCI_EXP_LNKCAP		12	/* Link Capabilities */  #define  PCI_EXP_LNKCAP_SLS	0x0000000f /* Supported Link Speeds */ +#define  PCI_EXP_LNKCAP_SLS_2_5GB 0x1	/* LNKCAP2 SLS Vector bit 0 (2.5GT/s) */ +#define  PCI_EXP_LNKCAP_SLS_5_0GB 0x2	/* LNKCAP2 SLS Vector bit 1 (5.0GT/s) */  #define  PCI_EXP_LNKCAP_MLW	0x000003f0 /* Maximum Link Width */  #define  PCI_EXP_LNKCAP_ASPMS	0x00000c00 /* ASPM Support */  #define  PCI_EXP_LNKCAP_L0SEL	0x00007000 /* L0s Exit Latency */ diff --git a/kernel/fork.c b/kernel/fork.c index a31b823b3c2..65ca6d27f24 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1166,6 +1166,14 @@ static struct task_struct *copy_process(unsigned long clone_flags,  				current->signal->flags & SIGNAL_UNKILLABLE)  		return ERR_PTR(-EINVAL); +	/* +	 * If the new process will be in a different pid namespace +	 * don't allow the creation of threads. +	 */ +	if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) && +	    (task_active_pid_ns(current) != current->nsproxy->pid_ns)) +		return ERR_PTR(-EINVAL); +  	retval = security_task_create(clone_flags);  	if (retval)  		goto fork_out; diff --git a/kernel/pid.c b/kernel/pid.c index 36aa02ff17d..de9af600006 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -270,7 +270,6 @@ void free_pid(struct pid *pid)  			wake_up_process(ns->child_reaper);  			break;  		case 0: -			ns->nr_hashed = -1;  			schedule_work(&ns->proc_work);  			break;  		} @@ -319,7 +318,7 @@ struct pid *alloc_pid(struct pid_namespace *ns)  	upid = pid->numbers + ns->level;  	spin_lock_irq(&pidmap_lock); -	if (ns->nr_hashed < 0) +	if (!(ns->nr_hashed & PIDNS_HASH_ADDING))  		goto out_unlock;  	for ( ; upid >= pid->numbers; --upid) {  		hlist_add_head_rcu(&upid->pid_chain, @@ -342,6 +341,13 @@ out_free:  	goto out;  } +void disable_pid_allocation(struct pid_namespace *ns) +{ +	spin_lock_irq(&pidmap_lock); +	ns->nr_hashed &= ~PIDNS_HASH_ADDING; +	spin_unlock_irq(&pidmap_lock); +} +  struct pid *find_pid_ns(int nr, struct pid_namespace *ns)  {  	struct hlist_node *elem; @@ -573,6 +579,9 @@ void __init pidhash_init(void)  void __init pidmap_init(void)  { +	/* Veryify no one has done anything silly */ +	BUILD_BUG_ON(PID_MAX_LIMIT >= PIDNS_HASH_ADDING); +  	/* bump default and minimum pid_max based on number of cpus */  	pid_max = min(pid_max_max, max_t(int, pid_max,  				PIDS_PER_CPU_DEFAULT * num_possible_cpus())); @@ -584,7 +593,7 @@ void __init pidmap_init(void)  	/* Reserve PID 0. We never call free_pidmap(0) */  	set_bit(0, init_pid_ns.pidmap[0].page);  	atomic_dec(&init_pid_ns.pidmap[0].nr_free); -	init_pid_ns.nr_hashed = 1; +	init_pid_ns.nr_hashed = PIDNS_HASH_ADDING;  	init_pid_ns.pid_cachep = KMEM_CACHE(pid,  			SLAB_HWCACHE_ALIGN | SLAB_PANIC); diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index fdbd0cdf271..c1c3dc1c602 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c @@ -115,6 +115,7 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns  	ns->level = level;  	ns->parent = get_pid_ns(parent_pid_ns);  	ns->user_ns = get_user_ns(user_ns); +	ns->nr_hashed = PIDNS_HASH_ADDING;  	INIT_WORK(&ns->proc_work, proc_cleanup_work);  	set_bit(0, ns->pidmap[0].page); @@ -181,6 +182,9 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns)  	int rc;  	struct task_struct *task, *me = current; +	/* Don't allow any more processes into the pid namespace */ +	disable_pid_allocation(pid_ns); +  	/* Ignore SIGCHLD causing any terminated children to autoreap */  	spin_lock_irq(&me->sighand->siglock);  	me->sighand->action[SIGCHLD - 1].sa.sa_handler = SIG_IGN; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index d1b315e9862..e2df1c1fb41 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2132,7 +2132,7 @@ bool __mpol_equal(struct mempolicy *a, struct mempolicy *b)   */  /* lookup first element intersecting start-end */ -/* Caller holds sp->mutex */ +/* Caller holds sp->lock */  static struct sp_node *  sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end)  { @@ -2196,13 +2196,13 @@ mpol_shared_policy_lookup(struct shared_policy *sp, unsigned long idx)  	if (!sp->root.rb_node)  		return NULL; -	mutex_lock(&sp->mutex); +	spin_lock(&sp->lock);  	sn = sp_lookup(sp, idx, idx+1);  	if (sn) {  		mpol_get(sn->policy);  		pol = sn->policy;  	} -	mutex_unlock(&sp->mutex); +	spin_unlock(&sp->lock);  	return pol;  } @@ -2328,6 +2328,14 @@ static void sp_delete(struct shared_policy *sp, struct sp_node *n)  	sp_free(n);  } +static void sp_node_init(struct sp_node *node, unsigned long start, +			unsigned long end, struct mempolicy *pol) +{ +	node->start = start; +	node->end = end; +	node->policy = pol; +} +  static struct sp_node *sp_alloc(unsigned long start, unsigned long end,  				struct mempolicy *pol)  { @@ -2344,10 +2352,7 @@ static struct sp_node *sp_alloc(unsigned long start, unsigned long end,  		return NULL;  	}  	newpol->flags |= MPOL_F_SHARED; - -	n->start = start; -	n->end = end; -	n->policy = newpol; +	sp_node_init(n, start, end, newpol);  	return n;  } @@ -2357,9 +2362,12 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,  				 unsigned long end, struct sp_node *new)  {  	struct sp_node *n; +	struct sp_node *n_new = NULL; +	struct mempolicy *mpol_new = NULL;  	int ret = 0; -	mutex_lock(&sp->mutex); +restart: +	spin_lock(&sp->lock);  	n = sp_lookup(sp, start, end);  	/* Take care of old policies in the same range. */  	while (n && n->start < end) { @@ -2372,14 +2380,16 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,  		} else {  			/* Old policy spanning whole new range. */  			if (n->end > end) { -				struct sp_node *new2; -				new2 = sp_alloc(end, n->end, n->policy); -				if (!new2) { -					ret = -ENOMEM; -					goto out; -				} +				if (!n_new) +					goto alloc_new; + +				*mpol_new = *n->policy; +				atomic_set(&mpol_new->refcnt, 1); +				sp_node_init(n_new, n->end, end, mpol_new); +				sp_insert(sp, n_new);  				n->end = start; -				sp_insert(sp, new2); +				n_new = NULL; +				mpol_new = NULL;  				break;  			} else  				n->end = start; @@ -2390,9 +2400,27 @@ static int shared_policy_replace(struct shared_policy *sp, unsigned long start,  	}  	if (new)  		sp_insert(sp, new); -out: -	mutex_unlock(&sp->mutex); +	spin_unlock(&sp->lock); +	ret = 0; + +err_out: +	if (mpol_new) +		mpol_put(mpol_new); +	if (n_new) +		kmem_cache_free(sn_cache, n_new); +  	return ret; + +alloc_new: +	spin_unlock(&sp->lock); +	ret = -ENOMEM; +	n_new = kmem_cache_alloc(sn_cache, GFP_KERNEL); +	if (!n_new) +		goto err_out; +	mpol_new = kmem_cache_alloc(policy_cache, GFP_KERNEL); +	if (!mpol_new) +		goto err_out; +	goto restart;  }  /** @@ -2410,7 +2438,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)  	int ret;  	sp->root = RB_ROOT;		/* empty tree == default mempolicy */ -	mutex_init(&sp->mutex); +	spin_lock_init(&sp->lock);  	if (mpol) {  		struct vm_area_struct pvma; @@ -2476,14 +2504,14 @@ void mpol_free_shared_policy(struct shared_policy *p)  	if (!p->root.rb_node)  		return; -	mutex_lock(&p->mutex); +	spin_lock(&p->lock);  	next = rb_first(&p->root);  	while (next) {  		n = rb_entry(next, struct sp_node, nd);  		next = rb_next(&n->nd);  		sp_delete(p, n);  	} -	mutex_unlock(&p->mutex); +	spin_unlock(&p->lock);  }  #ifdef CONFIG_NUMA_BALANCING @@ -2595,8 +2623,7 @@ void numa_default_policy(void)   */  /* - * "local" is pseudo-policy:  MPOL_PREFERRED with MPOL_F_LOCAL flag - * Used only for mpol_parse_str() and mpol_to_str() + * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag.   */  static const char * const policy_modes[] =  { @@ -2610,28 +2637,20 @@ static const char * const policy_modes[] =  #ifdef CONFIG_TMPFS  /** - * mpol_parse_str - parse string to mempolicy + * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option.   * @str:  string containing mempolicy to parse   * @mpol:  pointer to struct mempolicy pointer, returned on success. - * @no_context:  flag whether to "contextualize" the mempolicy   *   * Format of input:   *	<mode>[=<flags>][:<nodelist>]   * - * if @no_context is true, save the input nodemask in w.user_nodemask in - * the returned mempolicy.  This will be used to "clone" the mempolicy in - * a specific context [cpuset] at a later time.  Used to parse tmpfs mpol - * mount option.  Note that if 'static' or 'relative' mode flags were - * specified, the input nodemask will already have been saved.  Saving - * it again is redundant, but safe. - *   * On success, returns 0, else 1   */ -int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) +int mpol_parse_str(char *str, struct mempolicy **mpol)  {  	struct mempolicy *new = NULL;  	unsigned short mode; -	unsigned short uninitialized_var(mode_flags); +	unsigned short mode_flags;  	nodemask_t nodes;  	char *nodelist = strchr(str, ':');  	char *flags = strchr(str, '='); @@ -2719,24 +2738,23 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context)  	if (IS_ERR(new))  		goto out; -	if (no_context) { -		/* save for contextualization */ -		new->w.user_nodemask = nodes; -	} else { -		int ret; -		NODEMASK_SCRATCH(scratch); -		if (scratch) { -			task_lock(current); -			ret = mpol_set_nodemask(new, &nodes, scratch); -			task_unlock(current); -		} else -			ret = -ENOMEM; -		NODEMASK_SCRATCH_FREE(scratch); -		if (ret) { -			mpol_put(new); -			goto out; -		} -	} +	/* +	 * Save nodes for mpol_to_str() to show the tmpfs mount options +	 * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. +	 */ +	if (mode != MPOL_PREFERRED) +		new->v.nodes = nodes; +	else if (nodelist) +		new->v.preferred_node = first_node(nodes); +	else +		new->flags |= MPOL_F_LOCAL; + +	/* +	 * Save nodes for contextualization: this will be used to "clone" +	 * the mempolicy in a specific context [cpuset] at a later time. +	 */ +	new->w.user_nodemask = nodes; +  	err = 0;  out: @@ -2756,13 +2774,12 @@ out:   * @buffer:  to contain formatted mempolicy string   * @maxlen:  length of @buffer   * @pol:  pointer to mempolicy to be formatted - * @no_context:  "context free" mempolicy - use nodemask in w.user_nodemask   *   * Convert a mempolicy into a string.   * Returns the number of characters in buffer (if positive)   * or an error (negative)   */ -int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) +int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol)  {  	char *p = buffer;  	int l; @@ -2788,7 +2805,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)  	case MPOL_PREFERRED:  		nodes_clear(nodes);  		if (flags & MPOL_F_LOCAL) -			mode = MPOL_LOCAL;	/* pseudo-policy */ +			mode = MPOL_LOCAL;  		else  			node_set(pol->v.preferred_node, nodes);  		break; @@ -2796,10 +2813,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context)  	case MPOL_BIND:  		/* Fall through */  	case MPOL_INTERLEAVE: -		if (no_context) -			nodes = pol->w.user_nodemask; -		else -			nodes = pol->v.nodes; +		nodes = pol->v.nodes;  		break;  	default: diff --git a/mm/shmem.c b/mm/shmem.c index 5c90d84c2b0..5dd56f6efdb 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -889,7 +889,7 @@ static void shmem_show_mpol(struct seq_file *seq, struct mempolicy *mpol)  	if (!mpol || mpol->mode == MPOL_DEFAULT)  		return;		/* show nothing */ -	mpol_to_str(buffer, sizeof(buffer), mpol, 1); +	mpol_to_str(buffer, sizeof(buffer), mpol);  	seq_printf(seq, ",mpol=%s", buffer);  } @@ -2463,7 +2463,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,  			if (!gid_valid(sbinfo->gid))  				goto bad_val;  		} else if (!strcmp(this_char,"mpol")) { -			if (mpol_parse_str(value, &sbinfo->mpol, 1)) +			if (mpol_parse_str(value, &sbinfo->mpol))  				goto bad_val;  		} else {  			printk(KERN_ERR "tmpfs: Bad mount option %s\n", diff --git a/mm/vmscan.c b/mm/vmscan.c index adc7e905818..16b42af393a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2452,12 +2452,16 @@ static bool zone_balanced(struct zone *zone, int order,  }  /* - * pgdat_balanced is used when checking if a node is balanced for high-order - * allocations. Only zones that meet watermarks and are in a zone allowed - * by the callers classzone_idx are added to balanced_pages. The total of - * balanced pages must be at least 25% of the zones allowed by classzone_idx - * for the node to be considered balanced. Forcing all zones to be balanced - * for high orders can cause excessive reclaim when there are imbalanced zones. + * pgdat_balanced() is used when checking if a node is balanced. + * + * For order-0, all zones must be balanced! + * + * For high-order allocations only zones that meet watermarks and are in a + * zone allowed by the callers classzone_idx are added to balanced_pages. The + * total of balanced pages must be at least 25% of the zones allowed by + * classzone_idx for the node to be considered balanced. Forcing all zones to + * be balanced for high orders can cause excessive reclaim when there are + * imbalanced zones.   * The choice of 25% is due to   *   o a 16M DMA zone that is balanced will not balance a zone on any   *     reasonable sized machine @@ -2467,17 +2471,43 @@ static bool zone_balanced(struct zone *zone, int order,   *     Similarly, on x86-64 the Normal zone would need to be at least 1G   *     to balance a node on its own. These seemed like reasonable ratios.   */ -static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages, -						int classzone_idx) +static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)  {  	unsigned long present_pages = 0; +	unsigned long balanced_pages = 0;  	int i; -	for (i = 0; i <= classzone_idx; i++) -		present_pages += pgdat->node_zones[i].present_pages; +	/* Check the watermark levels */ +	for (i = 0; i <= classzone_idx; i++) { +		struct zone *zone = pgdat->node_zones + i; -	/* A special case here: if zone has no page, we think it's balanced */ -	return balanced_pages >= (present_pages >> 2); +		if (!populated_zone(zone)) +			continue; + +		present_pages += zone->present_pages; + +		/* +		 * A special case here: +		 * +		 * balance_pgdat() skips over all_unreclaimable after +		 * DEF_PRIORITY. Effectively, it considers them balanced so +		 * they must be considered balanced here as well! +		 */ +		if (zone->all_unreclaimable) { +			balanced_pages += zone->present_pages; +			continue; +		} + +		if (zone_balanced(zone, order, 0, i)) +			balanced_pages += zone->present_pages; +		else if (!order) +			return false; +	} + +	if (order) +		return balanced_pages >= (present_pages >> 2); +	else +		return true;  }  /* @@ -2489,10 +2519,6 @@ static bool pgdat_balanced(pg_data_t *pgdat, unsigned long balanced_pages,  static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,  					int classzone_idx)  { -	int i; -	unsigned long balanced = 0; -	bool all_zones_ok = true; -  	/* If a direct reclaimer woke kswapd within HZ/10, it's premature */  	if (remaining)  		return false; @@ -2511,39 +2537,7 @@ static bool prepare_kswapd_sleep(pg_data_t *pgdat, int order, long remaining,  		return false;  	} -	/* Check the watermark levels */ -	for (i = 0; i <= classzone_idx; i++) { -		struct zone *zone = pgdat->node_zones + i; - -		if (!populated_zone(zone)) -			continue; - -		/* -		 * balance_pgdat() skips over all_unreclaimable after -		 * DEF_PRIORITY. Effectively, it considers them balanced so -		 * they must be considered balanced here as well if kswapd -		 * is to sleep -		 */ -		if (zone->all_unreclaimable) { -			balanced += zone->present_pages; -			continue; -		} - -		if (!zone_balanced(zone, order, 0, i)) -			all_zones_ok = false; -		else -			balanced += zone->present_pages; -	} - -	/* -	 * For high-order requests, the balanced zones must contain at least -	 * 25% of the nodes pages for kswapd to sleep. For order-0, all zones -	 * must be balanced -	 */ -	if (order) -		return pgdat_balanced(pgdat, balanced, classzone_idx); -	else -		return all_zones_ok; +	return pgdat_balanced(pgdat, order, classzone_idx);  }  /* @@ -2571,7 +2565,6 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,  							int *classzone_idx)  {  	struct zone *unbalanced_zone; -	unsigned long balanced;  	int i;  	int end_zone = 0;	/* Inclusive.  0 = ZONE_DMA */  	unsigned long total_scanned; @@ -2605,7 +2598,6 @@ loop_again:  		int has_under_min_watermark_zone = 0;  		unbalanced_zone = NULL; -		balanced = 0;  		/*  		 * Scan in the highmem->dma direction for the highest @@ -2761,8 +2753,6 @@ loop_again:  				 * speculatively avoid congestion waits  				 */  				zone_clear_flag(zone, ZONE_CONGESTED); -				if (i <= *classzone_idx) -					balanced += zone->present_pages;  			}  		} @@ -2776,7 +2766,7 @@ loop_again:  				pfmemalloc_watermark_ok(pgdat))  			wake_up(&pgdat->pfmemalloc_wait); -		if (!unbalanced_zone || (order && pgdat_balanced(pgdat, balanced, *classzone_idx))) +		if (pgdat_balanced(pgdat, order, *classzone_idx))  			break;		/* kswapd: all done */  		/*  		 * OK, kswapd is getting into trouble.  Take a nap, then take @@ -2785,7 +2775,7 @@ loop_again:  		if (total_scanned && (sc.priority < DEF_PRIORITY - 2)) {  			if (has_under_min_watermark_zone)  				count_vm_event(KSWAPD_SKIP_CONGESTION_WAIT); -			else +			else if (unbalanced_zone)  				wait_iff_congested(unbalanced_zone, BLK_RW_ASYNC, HZ/10);  		} @@ -2800,12 +2790,7 @@ loop_again:  	} while (--sc.priority >= 0);  out: -	/* -	 * order-0: All zones must meet high watermark for a balanced node -	 * high-order: Balanced zones must make up at least 25% of the node -	 *             for the node to be balanced -	 */ -	if (unbalanced_zone && (!order || !pgdat_balanced(pgdat, balanced, *classzone_idx))) { +	if (!pgdat_balanced(pgdat, order, *classzone_idx)) {  		cond_resched();  		try_to_freeze(); diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 9f3925a85aa..7d02ebd11a7 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)  	unsigned int msecs;  	msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; -	msecs += (random32() % 2 * BATADV_JITTER); +	msecs += random32() % (2 * BATADV_JITTER);  	return jiffies + msecs_to_jiffies(msecs);  } diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 1c8fdc3558c..37fe693471a 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -366,11 +366,11 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)  	err = netdev_set_master(dev, br->dev);  	if (err) -		goto err3; +		goto err4;  	err = netdev_rx_handler_register(dev, br_handle_frame, p);  	if (err) -		goto err4; +		goto err5;  	dev->priv_flags |= IFF_BRIDGE_PORT; @@ -402,8 +402,10 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)  	return 0; -err4: +err5:  	netdev_set_master(dev, NULL); +err4: +	br_netpoll_disable(p);  err3:  	sysfs_remove_link(br->ifobj, p->dev->name);  err2: diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 4d111fd2b49..5ccf87ed8d6 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con)  {  	/* reset connection, out_queue, msg_ and connect_seq */  	/* discard existing out_queue and msg_seq */ +	dout("reset_connection %p\n", con);  	ceph_msg_remove_list(&con->out_queue);  	ceph_msg_remove_list(&con->out_sent); @@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con,  	mutex_lock(&con->mutex);  	dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); -	BUG_ON(con->state != CON_STATE_CLOSED); +	WARN_ON(con->state != CON_STATE_CLOSED);  	con->state = CON_STATE_PREOPEN;  	con->peer_name.type = (__u8) entity_type; @@ -1506,13 +1507,6 @@ static int process_banner(struct ceph_connection *con)  	return 0;  } -static void fail_protocol(struct ceph_connection *con) -{ -	reset_connection(con); -	BUG_ON(con->state != CON_STATE_NEGOTIATING); -	con->state = CON_STATE_CLOSED; -} -  static int process_connect(struct ceph_connection *con)  {  	u64 sup_feat = con->msgr->supported_features; @@ -1530,7 +1524,7 @@ static int process_connect(struct ceph_connection *con)  		       ceph_pr_addr(&con->peer_addr.in_addr),  		       sup_feat, server_feat, server_feat & ~sup_feat);  		con->error_msg = "missing required protocol features"; -		fail_protocol(con); +		reset_connection(con);  		return -1;  	case CEPH_MSGR_TAG_BADPROTOVER: @@ -1541,7 +1535,7 @@ static int process_connect(struct ceph_connection *con)  		       le32_to_cpu(con->out_connect.protocol_version),  		       le32_to_cpu(con->in_reply.protocol_version));  		con->error_msg = "protocol version mismatch"; -		fail_protocol(con); +		reset_connection(con);  		return -1;  	case CEPH_MSGR_TAG_BADAUTHORIZER: @@ -1631,11 +1625,11 @@ static int process_connect(struct ceph_connection *con)  			       ceph_pr_addr(&con->peer_addr.in_addr),  			       req_feat, server_feat, req_feat & ~server_feat);  			con->error_msg = "missing required protocol features"; -			fail_protocol(con); +			reset_connection(con);  			return -1;  		} -		BUG_ON(con->state != CON_STATE_NEGOTIATING); +		WARN_ON(con->state != CON_STATE_NEGOTIATING);  		con->state = CON_STATE_OPEN;  		con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); @@ -2132,7 +2126,6 @@ more:  		if (ret < 0)  			goto out; -		BUG_ON(con->state != CON_STATE_CONNECTING);  		con->state = CON_STATE_NEGOTIATING;  		/* @@ -2160,7 +2153,7 @@ more:  		goto more;  	} -	BUG_ON(con->state != CON_STATE_OPEN); +	WARN_ON(con->state != CON_STATE_OPEN);  	if (con->in_base_pos < 0) {  		/* @@ -2382,7 +2375,7 @@ static void ceph_fault(struct ceph_connection *con)  	dout("fault %p state %lu to peer %s\n",  	     con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); -	BUG_ON(con->state != CON_STATE_CONNECTING && +	WARN_ON(con->state != CON_STATE_CONNECTING &&  	       con->state != CON_STATE_NEGOTIATING &&  	       con->state != CON_STATE_OPEN); diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 780caf6b049..eb9a4447876 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1270,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc)   * Requeue requests whose mapping to an OSD has changed.  If requests map to   * no osd, request a new map.   * - * Caller should hold map_sem for read and request_mutex. + * Caller should hold map_sem for read.   */  static void kick_requests(struct ceph_osd_client *osdc, int force_resend)  { @@ -1284,6 +1284,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)  	for (p = rb_first(&osdc->requests); p; ) {  		req = rb_entry(p, struct ceph_osd_request, r_node);  		p = rb_next(p); + +		/* +		 * For linger requests that have not yet been +		 * registered, move them to the linger list; they'll +		 * be sent to the osd in the loop below.  Unregister +		 * the request before re-registering it as a linger +		 * request to ensure the __map_request() below +		 * will decide it needs to be sent. +		 */ +		if (req->r_linger && list_empty(&req->r_linger_item)) { +			dout("%p tid %llu restart on osd%d\n", +			     req, req->r_tid, +			     req->r_osd ? req->r_osd->o_osd : -1); +			__unregister_request(osdc, req); +			__register_linger_request(osdc, req); +			continue; +		} +  		err = __map_request(osdc, req, force_resend);  		if (err < 0)  			continue;  /* error */ @@ -1298,17 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)  				req->r_flags |= CEPH_OSD_FLAG_RETRY;  			}  		} -		if (req->r_linger && list_empty(&req->r_linger_item)) { -			/* -			 * register as a linger so that we will -			 * re-submit below and get a new tid -			 */ -			dout("%p tid %llu restart on osd%d\n", -			     req, req->r_tid, -			     req->r_osd ? req->r_osd->o_osd : -1); -			__register_linger_request(osdc, req); -			__unregister_request(osdc, req); -		}  	}  	list_for_each_entry_safe(req, nreq, &osdc->req_linger, @@ -1316,6 +1323,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)  		dout("linger req=%p req->r_osd=%p\n", req, req->r_osd);  		err = __map_request(osdc, req, force_resend); +		dout("__map_request returned %d\n", err);  		if (err == 0)  			continue;  /* no change and no osd was specified */  		if (err < 0) @@ -1337,6 +1345,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend)  		dout("%d requests for down osds, need new map\n", needmap);  		ceph_monc_request_next_osdmap(&osdc->client->monc);  	} +	reset_changed_osds(osdc);  } @@ -1393,7 +1402,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg)  				osdc->osdmap = newmap;  			}  			kick_requests(osdc, 0); -			reset_changed_osds(osdc);  		} else {  			dout("ignoring incremental map %u len %d\n",  			     epoch, maplen); diff --git a/net/core/dev.c b/net/core/dev.c index d0cbc93fcf3..515473ee52c 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -203,7 +203,7 @@ static struct list_head offload_base __read_mostly;  DEFINE_RWLOCK(dev_base_lock);  EXPORT_SYMBOL(dev_base_lock); -DEFINE_SEQLOCK(devnet_rename_seq); +seqcount_t devnet_rename_seq;  static inline void dev_base_seq_inc(struct net *net)  { @@ -1093,10 +1093,10 @@ int dev_change_name(struct net_device *dev, const char *newname)  	if (dev->flags & IFF_UP)  		return -EBUSY; -	write_seqlock(&devnet_rename_seq); +	write_seqcount_begin(&devnet_rename_seq);  	if (strncmp(newname, dev->name, IFNAMSIZ) == 0) { -		write_sequnlock(&devnet_rename_seq); +		write_seqcount_end(&devnet_rename_seq);  		return 0;  	} @@ -1104,7 +1104,7 @@ int dev_change_name(struct net_device *dev, const char *newname)  	err = dev_get_valid_name(net, dev, newname);  	if (err < 0) { -		write_sequnlock(&devnet_rename_seq); +		write_seqcount_end(&devnet_rename_seq);  		return err;  	} @@ -1112,11 +1112,11 @@ rollback:  	ret = device_rename(&dev->dev, dev->name);  	if (ret) {  		memcpy(dev->name, oldname, IFNAMSIZ); -		write_sequnlock(&devnet_rename_seq); +		write_seqcount_end(&devnet_rename_seq);  		return ret;  	} -	write_sequnlock(&devnet_rename_seq); +	write_seqcount_end(&devnet_rename_seq);  	write_lock_bh(&dev_base_lock);  	hlist_del_rcu(&dev->name_hlist); @@ -1135,7 +1135,7 @@ rollback:  		/* err >= 0 after dev_alloc_name() or stores the first errno */  		if (err >= 0) {  			err = ret; -			write_seqlock(&devnet_rename_seq); +			write_seqcount_begin(&devnet_rename_seq);  			memcpy(dev->name, oldname, IFNAMSIZ);  			goto rollback;  		} else { @@ -4180,7 +4180,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)  		return -EFAULT;  retry: -	seq = read_seqbegin(&devnet_rename_seq); +	seq = read_seqcount_begin(&devnet_rename_seq);  	rcu_read_lock();  	dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);  	if (!dev) { @@ -4190,7 +4190,7 @@ retry:  	strcpy(ifr.ifr_name, dev->name);  	rcu_read_unlock(); -	if (read_seqretry(&devnet_rename_seq, seq)) +	if (read_seqcount_retry(&devnet_rename_seq, seq))  		goto retry;  	if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 334efd5d67a..28c5f5aa7ca 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -1334,7 +1334,6 @@ struct kobj_ns_type_operations net_ns_type_operations = {  };  EXPORT_SYMBOL_GPL(net_ns_type_operations); -#ifdef CONFIG_HOTPLUG  static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)  {  	struct net_device *dev = to_net_dev(d); @@ -1353,7 +1352,6 @@ static int netdev_uevent(struct device *d, struct kobj_uevent_env *env)  exit:  	return retval;  } -#endif  /*   *	netdev_release -- destroy and free a dead device. @@ -1382,9 +1380,7 @@ static struct class net_class = {  #ifdef CONFIG_SYSFS  	.dev_attrs = net_class_attributes,  #endif /* CONFIG_SYSFS */ -#ifdef CONFIG_HOTPLUG  	.dev_uevent = netdev_uevent, -#endif  	.ns_type = &net_ns_type_operations,  	.namespace = net_namespace,  }; diff --git a/net/core/sock.c b/net/core/sock.c index a692ef49c9b..bc131d41968 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -583,7 +583,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,  		goto out;  retry: -	seq = read_seqbegin(&devnet_rename_seq); +	seq = read_seqcount_begin(&devnet_rename_seq);  	rcu_read_lock();  	dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);  	ret = -ENODEV; @@ -594,7 +594,7 @@ retry:  	strcpy(devname, dev->name);  	rcu_read_unlock(); -	if (read_seqretry(&devnet_rename_seq, seq)) +	if (read_seqcount_retry(&devnet_rename_seq, seq))  		goto retry;  	len = strlen(devname) + 1; diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index ce6fbdfd40b..9547a273b9e 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -321,7 +321,7 @@ static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb)  static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)  {  	__be32 saddr = 0; -	u8  *dst_ha = NULL; +	u8 dst_ha[MAX_ADDR_LEN], *dst_hw = NULL;  	struct net_device *dev = neigh->dev;  	__be32 target = *(__be32 *)neigh->primary_key;  	int probes = atomic_read(&neigh->probes); @@ -363,8 +363,8 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)  	if (probes < 0) {  		if (!(neigh->nud_state & NUD_VALID))  			pr_debug("trying to ucast probe in NUD_INVALID\n"); -		dst_ha = neigh->ha; -		read_lock_bh(&neigh->lock); +		neigh_ha_snapshot(dst_ha, neigh, dev); +		dst_hw = dst_ha;  	} else {  		probes -= neigh->parms->app_probes;  		if (probes < 0) { @@ -376,9 +376,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)  	}  	arp_send(ARPOP_REQUEST, ETH_P_ARP, target, dev, saddr, -		 dst_ha, dev->dev_addr, NULL); -	if (dst_ha) -		read_unlock_bh(&neigh->lock); +		 dst_hw, dev->dev_addr, NULL);  }  static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index a85ae2f7a21..303012adf9e 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -750,6 +750,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev  	int    gre_hlen;  	__be32 dst;  	int    mtu; +	u8     ttl;  	if (skb->ip_summed == CHECKSUM_PARTIAL &&  	    skb_checksum_help(skb)) @@ -760,7 +761,10 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev  	if (dev->header_ops && dev->type == ARPHRD_IPGRE) {  		gre_hlen = 0; -		tiph = (const struct iphdr *)skb->data; +		if (skb->protocol == htons(ETH_P_IP)) +			tiph = (const struct iphdr *)skb->data; +		else +			tiph = &tunnel->parms.iph;  	} else {  		gre_hlen = tunnel->hlen;  		tiph = &tunnel->parms.iph; @@ -812,6 +816,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev  			goto tx_error;  	} +	ttl = tiph->ttl;  	tos = tiph->tos;  	if (tos == 1) {  		tos = 0; @@ -904,11 +909,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev  		dev_kfree_skb(skb);  		skb = new_skb;  		old_iph = ip_hdr(skb); +		/* Warning : tiph value might point to freed memory */  	} -	skb_reset_transport_header(skb);  	skb_push(skb, gre_hlen);  	skb_reset_network_header(skb); +	skb_set_transport_header(skb, sizeof(*iph));  	memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));  	IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED |  			      IPSKB_REROUTED); @@ -927,8 +933,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev  	iph->tos		=	ipgre_ecn_encapsulate(tos, old_iph, skb);  	iph->daddr		=	fl4.daddr;  	iph->saddr		=	fl4.saddr; +	iph->ttl		=	ttl; -	if ((iph->ttl = tiph->ttl) == 0) { +	if (ttl == 0) {  		if (skb->protocol == htons(ETH_P_IP))  			iph->ttl = old_iph->ttl;  #if IS_ENABLED(CONFIG_IPV6) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a13692560e6..a28e4db8a95 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5543,6 +5543,9 @@ slow_path:  	if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))  		goto csum_error; +	if (!th->ack) +		goto discard; +  	/*  	 *	Standard slow path.  	 */ @@ -5551,7 +5554,7 @@ slow_path:  		return 0;  step5: -	if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) +	if (tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)  		goto discard;  	/* ts_recent update must be made after we are sure that the packet @@ -5984,11 +5987,15 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,  		if (tcp_check_req(sk, skb, req, NULL, true) == NULL)  			goto discard;  	} + +	if (!th->ack) +		goto discard; +  	if (!tcp_validate_incoming(sk, skb, th, 0))  		return 0;  	/* step 5: check the ACK field */ -	if (th->ack) { +	if (true) {  		int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0;  		switch (sk->sk_state) { @@ -6138,8 +6145,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,  			}  			break;  		} -	} else -		goto discard; +	}  	/* ts_recent update must be made after we are sure that the packet  	 * is in window. diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 867466c96aa..c727e471275 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -758,8 +758,6 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,  		skb_dst_set_noref(skb, dst);  	} -	skb->transport_header = skb->network_header; -  	proto = NEXTHDR_GRE;  	if (encap_limit >= 0) {  		init_tel_txopt(&opt, encap_limit); @@ -768,6 +766,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,  	skb_push(skb, gre_hlen);  	skb_reset_network_header(skb); +	skb_set_transport_header(skb, sizeof(*ipv6h));  	/*  	 *	Push down and install the IP header. diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c index a1e11627747..31b74f5e61a 100644 --- a/net/rds/ib_cm.c +++ b/net/rds/ib_cm.c @@ -434,12 +434,11 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event)  		version = RDS_PROTOCOL_3_0;  		while ((common >>= 1) != 0)  			version++; -	} -	printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using " -			"incompatible protocol version %u.%u\n", -			&dp->dp_saddr, -			dp->dp_protocol_major, -			dp->dp_protocol_minor); +	} else +		printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI4 using incompatible protocol version %u.%u\n", +				&dp->dp_saddr, +				dp->dp_protocol_major, +				dp->dp_protocol_minor);  	return version;  } diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 8c5bc857f04..8eb9501e3d6 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -339,8 +339,8 @@ static int rds_ib_recv_refill_one(struct rds_connection *conn,  	sge->length = sizeof(struct rds_header);  	sge = &recv->r_sge[1]; -	sge->addr = sg_dma_address(&recv->r_frag->f_sg); -	sge->length = sg_dma_len(&recv->r_frag->f_sg); +	sge->addr = ib_sg_dma_address(ic->i_cm_id->device, &recv->r_frag->f_sg); +	sge->length = ib_sg_dma_len(ic->i_cm_id->device, &recv->r_frag->f_sg);  	ret = 0;  out: @@ -381,7 +381,10 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill)  		ret = ib_post_recv(ic->i_cm_id->qp, &recv->r_wr, &failed_wr);  		rdsdebug("recv %p ibinc %p page %p addr %lu ret %d\n", recv,  			 recv->r_ibinc, sg_page(&recv->r_frag->f_sg), -			 (long) sg_dma_address(&recv->r_frag->f_sg), ret); +			 (long) ib_sg_dma_address( +				ic->i_cm_id->device, +				&recv->r_frag->f_sg), +			ret);  		if (ret) {  			rds_ib_conn_error(conn, "recv post on "  			       "%pI4 returned %d, disconnecting and " diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index d2922c0ef57..51561eafcb7 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -919,7 +919,7 @@ ok:  	q->now = ktime_to_ns(ktime_get());  	start_at = jiffies; -	next_event = q->now + 5 * NSEC_PER_SEC; +	next_event = q->now + 5LLU * NSEC_PER_SEC;  	for (level = 0; level < TC_HTB_MAXDEPTH; level++) {  		/* common case optimization - skip event handler quickly */ diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 6e5308998e3..82c4fc7c994 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2365,7 +2365,6 @@ int set_regdom(const struct ieee80211_regdomain *rd)  	return r;  } -#ifdef CONFIG_HOTPLUG  int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)  {  	if (last_request && !last_request->processed) { @@ -2377,12 +2376,6 @@ int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env)  	return 0;  } -#else -int reg_device_uevent(struct device *dev, struct kobj_uevent_env *env) -{ -	return -ENODEV; -} -#endif /* CONFIG_HOTPLUG */  void wiphy_regulatory_register(struct wiphy *wiphy)  { diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c index 9bf6d5e3216..1f6f01e2dc4 100644 --- a/net/wireless/sysfs.c +++ b/net/wireless/sysfs.c @@ -77,13 +77,11 @@ static void wiphy_dev_release(struct device *dev)  	cfg80211_dev_free(rdev);  } -#ifdef CONFIG_HOTPLUG  static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)  {  	/* TODO, we probably need stuff here */  	return 0;  } -#endif  static int wiphy_suspend(struct device *dev, pm_message_t state)  { @@ -134,9 +132,7 @@ struct class ieee80211_class = {  	.owner = THIS_MODULE,  	.dev_release = wiphy_dev_release,  	.dev_attrs = ieee80211_dev_attrs, -#ifdef CONFIG_HOTPLUG  	.dev_uevent = wiphy_uevent, -#endif  	.suspend = wiphy_suspend,  	.resume = wiphy_resume,  	.ns_type = &net_ns_type_operations, diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl index 6c353ae8a45..581ca99c96f 100644 --- a/scripts/headers_install.pl +++ b/scripts/headers_install.pl @@ -42,9 +42,9 @@ foreach my $filename (@files) {  		$line =~ s/(^|\s)(inline)\b/$1__$2__/g;  		$line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;  		$line =~ s/(^|\s|[(])(volatile)\b(\s|[(]|$)/$1__$2__$3/g; -		$line =~ s/#ifndef _UAPI/#ifndef /; -		$line =~ s/#define _UAPI/#define /; -		$line =~ s!#endif /[*] _UAPI!#endif /* !; +		$line =~ s/#ifndef\s+_UAPI/#ifndef /; +		$line =~ s/#define\s+_UAPI/#define /; +		$line =~ s!#endif\s+/[*]\s*_UAPI!#endif /* !;  		printf {$out} "%s", $line;  	}  	close $out;  |