aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_processor.c9
-rw-r--r--drivers/acpi/acpi_video.c9
-rw-r--r--drivers/acpi/acpica/hwregs.c23
-rw-r--r--drivers/acpi/processor_throttling.c9
-rw-r--r--drivers/atm/firestream.c6
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/cpufreq/cpufreq.c2
-rw-r--r--drivers/cpufreq/intel_pstate.c2
-rw-r--r--drivers/crypto/ccp/ccp-crypto-aes-xts.c17
-rw-r--r--drivers/crypto/omap-sham.c2
-rw-r--r--drivers/dma-buf/dma-buf.c7
-rw-r--r--drivers/dma-buf/reservation.c72
-rw-r--r--drivers/gpio/gpio-lpc32xx.c48
-rw-r--r--drivers/gpio/gpiolib.c51
-rw-r--r--drivers/gpu/drm/arc/arcpgu_drv.c2
-rw-r--r--drivers/gpu/drm/arm/hdlcd_crtc.c86
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.c68
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.h5
-rw-r--r--drivers/gpu/drm/armada/armada_drv.c2
-rw-r--r--drivers/gpu/drm/ast/ast_drv.c2
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c10
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c2
-rw-r--r--drivers/gpu/drm/bochs/bochs_drv.c2
-rw-r--r--drivers/gpu/drm/cirrus/cirrus_drv.c2
-rw-r--r--drivers/gpu/drm/drm_atomic.c3
-rw-r--r--drivers/gpu/drm/drm_crtc.c5
-rw-r--r--drivers/gpu/drm/drm_fb_cma_helper.c2
-rw-r--r--drivers/gpu/drm/drm_gem_cma_helper.c12
-rw-r--r--drivers/gpu/drm/drm_modes.c2
-rw-r--r--drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c2
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c13
-rw-r--r--drivers/gpu/drm/imx/imx-drm.h7
-rw-r--r--drivers/gpu/drm/imx/imx-ldb.c78
-rw-r--r--drivers/gpu/drm/imx/imx-tve.c6
-rw-r--r--drivers/gpu/drm/imx/ipuv3-crtc.c10
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c5
-rw-r--r--drivers/gpu/drm/imx/parallel-display.c40
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dpi.c5
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dsi.c4
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_drv.c2
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c10
-rw-r--r--drivers/gpu/drm/msm/msm_fb.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drm.c2
-rw-r--r--drivers/gpu/drm/omapdrm/Kconfig1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/connector-hdmi.c1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/encoder-opa362.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-dpi.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c1
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c2
-rw-r--r--drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dsi.c9
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c11
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4_core.c2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5.c10
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5_core.c6
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_phy.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_pll.c1
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi_wp.c1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_debugfs.c2
-rw-r--r--drivers/gpu/drm/omapdrm/omap_dmm_tiler.c1
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c10
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c1
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.c2
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_drv.c2
-rw-r--r--drivers/gpu/drm/rockchip/rockchip_drm_drv.c10
-rw-r--r--drivers/gpu/drm/shmobile/shmob_drm_drv.c2
-rw-r--r--drivers/gpu/drm/sti/sti_crtc.c10
-rw-r--r--drivers/gpu/drm/sti/sti_cursor.c7
-rw-r--r--drivers/gpu/drm/sti/sti_drv.c8
-rw-r--r--drivers/gpu/drm/sti/sti_dvo.c7
-rw-r--r--drivers/gpu/drm/sti/sti_gdp.c14
-rw-r--r--drivers/gpu/drm/sti/sti_hda.c7
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi.c7
-rw-r--r--drivers/gpu/drm/sti/sti_hqvdp.c7
-rw-r--r--drivers/gpu/drm/sti/sti_mixer.c7
-rw-r--r--drivers/gpu/drm/sti/sti_tvout.c7
-rw-r--r--drivers/gpu/drm/sti/sti_vid.c7
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c2
-rw-r--r--drivers/gpu/drm/tilcdc/tilcdc_drv.c2
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_drv.c2
-rw-r--r--drivers/irqchip/irq-gic-v3-its.c49
-rw-r--r--drivers/irqchip/irq-gic-v3.c2
-rw-r--r--drivers/irqchip/irq-pic32-evic.c2
-rw-r--r--drivers/mmc/core/mmc.c4
-rw-r--r--drivers/mmc/host/sunxi-mmc.c9
-rw-r--r--drivers/net/ethernet/arc/emac_mdio.c2
-rw-r--r--drivers/net/ethernet/atheros/alx/alx.h4
-rw-r--r--drivers/net/ethernet/atheros/alx/main.c48
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c17
-rw-r--r--drivers/net/ethernet/ezchip/nps_enet.c4
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c8
-rw-r--r--drivers/net/ethernet/hisilicon/hns/hns_ethtool.c11
-rw-r--r--drivers/net/ethernet/marvell/mvneta_bm.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_ethtool.c2
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_netdev.c17
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_port.c18
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/en_tx.c8
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/mlx4_en.h3
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_dcbx.c5
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_dev.c52
-rw-r--r--drivers/net/ethernet/qlogic/qed/qed_main.c18
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_ethtool.c5
-rw-r--r--drivers/net/ethernet/qlogic/qede/qede_main.c26
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c3
-rw-r--r--drivers/net/ethernet/sfc/ef10.c16
-rw-r--r--drivers/net/ethernet/sfc/efx.c32
-rw-r--r--drivers/net/ethernet/sfc/net_driver.h12
-rw-r--r--drivers/net/ethernet/sfc/rx.c102
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c2
-rw-r--r--drivers/net/team/team.c9
-rw-r--r--drivers/net/usb/pegasus.c2
-rw-r--r--drivers/net/usb/smsc95xx.c51
-rw-r--r--drivers/net/virtio_net.c18
-rw-r--r--drivers/net/vxlan.c3
-rw-r--r--drivers/perf/arm_pmu.c12
-rw-r--r--drivers/pinctrl/mediatek/pinctrl-mtk-common.c5
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-nomadik.c2
-rw-r--r--drivers/ptp/ptp_chardev.c12
-rw-r--r--drivers/scsi/aacraid/aacraid.h5
-rw-r--r--drivers/scsi/aacraid/linit.c11
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_scsih.c3
-rw-r--r--drivers/scsi/scsi_lib.c7
-rw-r--r--drivers/scsi/sd.c9
-rw-r--r--drivers/thermal/int340x_thermal/int3406_thermal.c2
-rw-r--r--drivers/tty/Kconfig11
-rw-r--r--drivers/tty/pty.c15
-rw-r--r--drivers/vfio/pci/vfio_pci_config.c3
-rw-r--r--drivers/vfio/pci/vfio_pci_intrs.c6
-rw-r--r--drivers/vfio/vfio_iommu_type1.c2
-rw-r--r--drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c6
135 files changed, 841 insertions, 676 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 0d92d0f915e9..c7ba948d253c 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -331,15 +331,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
331 pr->throttling.duty_width = acpi_gbl_FADT.duty_width; 331 pr->throttling.duty_width = acpi_gbl_FADT.duty_width;
332 332
333 pr->pblk = object.processor.pblk_address; 333 pr->pblk = object.processor.pblk_address;
334
335 /*
336 * We don't care about error returns - we just try to mark
337 * these reserved so that nobody else is confused into thinking
338 * that this region might be unused..
339 *
340 * (In particular, allocating the IO range for Cardbus)
341 */
342 request_region(pr->throttling.address, 6, "ACPI CPU throttle");
343 } 334 }
344 335
345 /* 336 /*
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 3d5b8a099351..c1d138e128cb 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -754,7 +754,8 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device,
754} 754}
755 755
756int acpi_video_get_levels(struct acpi_device *device, 756int acpi_video_get_levels(struct acpi_device *device,
757 struct acpi_video_device_brightness **dev_br) 757 struct acpi_video_device_brightness **dev_br,
758 int *pmax_level)
758{ 759{
759 union acpi_object *obj = NULL; 760 union acpi_object *obj = NULL;
760 int i, max_level = 0, count = 0, level_ac_battery = 0; 761 int i, max_level = 0, count = 0, level_ac_battery = 0;
@@ -841,6 +842,8 @@ int acpi_video_get_levels(struct acpi_device *device,
841 842
842 br->count = count; 843 br->count = count;
843 *dev_br = br; 844 *dev_br = br;
845 if (pmax_level)
846 *pmax_level = max_level;
844 847
845out: 848out:
846 kfree(obj); 849 kfree(obj);
@@ -869,7 +872,7 @@ acpi_video_init_brightness(struct acpi_video_device *device)
869 struct acpi_video_device_brightness *br = NULL; 872 struct acpi_video_device_brightness *br = NULL;
870 int result = -EINVAL; 873 int result = -EINVAL;
871 874
872 result = acpi_video_get_levels(device->dev, &br); 875 result = acpi_video_get_levels(device->dev, &br, &max_level);
873 if (result) 876 if (result)
874 return result; 877 return result;
875 device->brightness = br; 878 device->brightness = br;
@@ -1737,7 +1740,7 @@ static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video)
1737 1740
1738 mutex_lock(&video->device_list_lock); 1741 mutex_lock(&video->device_list_lock);
1739 list_for_each_entry(dev, &video->video_device_list, entry) { 1742 list_for_each_entry(dev, &video->video_device_list, entry) {
1740 if (!acpi_video_device_lcd_query_levels(dev, &levels)) 1743 if (!acpi_video_device_lcd_query_levels(dev->dev->handle, &levels))
1741 kfree(levels); 1744 kfree(levels);
1742 } 1745 }
1743 mutex_unlock(&video->device_list_lock); 1746 mutex_unlock(&video->device_list_lock);
diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c
index 0f18dbc9a37f..daceb80022b0 100644
--- a/drivers/acpi/acpica/hwregs.c
+++ b/drivers/acpi/acpica/hwregs.c
@@ -83,27 +83,22 @@ acpi_hw_write_multiple(u32 value,
83static u8 83static u8
84acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width) 84acpi_hw_get_access_bit_width(struct acpi_generic_address *reg, u8 max_bit_width)
85{ 85{
86 u64 address;
87
88 if (!reg->access_width) { 86 if (!reg->access_width) {
87 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
88 max_bit_width = 32;
89 }
90
89 /* 91 /*
90 * Detect old register descriptors where only the bit_width field 92 * Detect old register descriptors where only the bit_width field
91 * makes senses. The target address is copied to handle possible 93 * makes senses.
92 * alignment issues.
93 */ 94 */
94 ACPI_MOVE_64_TO_64(&address, &reg->address); 95 if (reg->bit_width < max_bit_width &&
95 if (!reg->bit_offset && reg->bit_width && 96 !reg->bit_offset && reg->bit_width &&
96 ACPI_IS_POWER_OF_TWO(reg->bit_width) && 97 ACPI_IS_POWER_OF_TWO(reg->bit_width) &&
97 ACPI_IS_ALIGNED(reg->bit_width, 8) && 98 ACPI_IS_ALIGNED(reg->bit_width, 8)) {
98 ACPI_IS_ALIGNED(address, reg->bit_width)) {
99 return (reg->bit_width); 99 return (reg->bit_width);
100 } else {
101 if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
102 return (32);
103 } else {
104 return (max_bit_width);
105 }
106 } 100 }
101 return (max_bit_width);
107 } else { 102 } else {
108 return (1 << (reg->access_width + 2)); 103 return (1 << (reg->access_width + 2));
109 } 104 }
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index f170d746336d..c72e64893d03 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -676,6 +676,15 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)
676 if (!pr->flags.throttling) 676 if (!pr->flags.throttling)
677 return -ENODEV; 677 return -ENODEV;
678 678
679 /*
680 * We don't care about error returns - we just try to mark
681 * these reserved so that nobody else is confused into thinking
682 * that this region might be unused..
683 *
684 * (In particular, allocating the IO range for Cardbus)
685 */
686 request_region(pr->throttling.address, 6, "ACPI CPU throttle");
687
679 pr->throttling.state = 0; 688 pr->throttling.state = 0;
680 689
681 duty_mask = pr->throttling.state_count - 1; 690 duty_mask = pr->throttling.state_count - 1;
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index a969a7e443be..85aaf2222587 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -181,13 +181,17 @@ static char *res_strings[] = {
181 "reserved 27", 181 "reserved 27",
182 "reserved 28", 182 "reserved 28",
183 "reserved 29", 183 "reserved 29",
184 "reserved 30", 184 "reserved 30", /* FIXME: The strings between 30-40 might be wrong. */
185 "reassembly abort: no buffers", 185 "reassembly abort: no buffers",
186 "receive buffer overflow", 186 "receive buffer overflow",
187 "change in GFC", 187 "change in GFC",
188 "receive buffer full", 188 "receive buffer full",
189 "low priority discard - no receive descriptor", 189 "low priority discard - no receive descriptor",
190 "low priority discard - missing end of packet", 190 "low priority discard - missing end of packet",
191 "reserved 37",
192 "reserved 38",
193 "reserved 39",
194 "reseverd 40",
191 "reserved 41", 195 "reserved 41",
192 "reserved 42", 196 "reserved 42",
193 "reserved 43", 197 "reserved 43",
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 7d00f2994738..809dd1e02091 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -1128,7 +1128,7 @@ static int rx_pkt(struct atm_dev *dev)
1128 /* make the ptr point to the corresponding buffer desc entry */ 1128 /* make the ptr point to the corresponding buffer desc entry */
1129 buf_desc_ptr += desc; 1129 buf_desc_ptr += desc;
1130 if (!desc || (desc > iadev->num_rx_desc) || 1130 if (!desc || (desc > iadev->num_rx_desc) ||
1131 ((buf_desc_ptr->vc_index & 0xffff) > iadev->num_vc)) { 1131 ((buf_desc_ptr->vc_index & 0xffff) >= iadev->num_vc)) {
1132 free_desc(dev, desc); 1132 free_desc(dev, desc);
1133 IF_ERR(printk("IA: bad descriptor desc = %d \n", desc);) 1133 IF_ERR(printk("IA: bad descriptor desc = %d \n", desc);)
1134 return -1; 1134 return -1;
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 36bc11a106aa..9009295f5134 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1832,7 +1832,7 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier);
1832unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy, 1832unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
1833 unsigned int target_freq) 1833 unsigned int target_freq)
1834{ 1834{
1835 clamp_val(target_freq, policy->min, policy->max); 1835 target_freq = clamp_val(target_freq, policy->min, policy->max);
1836 1836
1837 return cpufreq_driver->fast_switch(policy, target_freq); 1837 return cpufreq_driver->fast_switch(policy, target_freq);
1838} 1838}
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 3a9c4325d6e2..0d159b513469 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -449,7 +449,7 @@ static void intel_pstate_init_acpi_perf_limits(struct cpufreq_policy *policy)
449 cpu->acpi_perf_data.states[0].core_frequency = 449 cpu->acpi_perf_data.states[0].core_frequency =
450 policy->cpuinfo.max_freq / 1000; 450 policy->cpuinfo.max_freq / 1000;
451 cpu->valid_pss_table = true; 451 cpu->valid_pss_table = true;
452 pr_info("_PPC limits will be enforced\n"); 452 pr_debug("_PPC limits will be enforced\n");
453 453
454 return; 454 return;
455 455
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-xts.c b/drivers/crypto/ccp/ccp-crypto-aes-xts.c
index 52c7395cb8d8..0d0d4529ee36 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-xts.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-xts.c
@@ -122,6 +122,7 @@ static int ccp_aes_xts_crypt(struct ablkcipher_request *req,
122 struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm); 122 struct ccp_ctx *ctx = crypto_tfm_ctx(req->base.tfm);
123 struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req); 123 struct ccp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
124 unsigned int unit; 124 unsigned int unit;
125 u32 unit_size;
125 int ret; 126 int ret;
126 127
127 if (!ctx->u.aes.key_len) 128 if (!ctx->u.aes.key_len)
@@ -133,11 +134,17 @@ static int ccp_aes_xts_crypt(struct ablkcipher_request *req,
133 if (!req->info) 134 if (!req->info)
134 return -EINVAL; 135 return -EINVAL;
135 136
136 for (unit = 0; unit < ARRAY_SIZE(unit_size_map); unit++) 137 unit_size = CCP_XTS_AES_UNIT_SIZE__LAST;
137 if (!(req->nbytes & (unit_size_map[unit].size - 1))) 138 if (req->nbytes <= unit_size_map[0].size) {
138 break; 139 for (unit = 0; unit < ARRAY_SIZE(unit_size_map); unit++) {
140 if (!(req->nbytes & (unit_size_map[unit].size - 1))) {
141 unit_size = unit_size_map[unit].value;
142 break;
143 }
144 }
145 }
139 146
140 if ((unit_size_map[unit].value == CCP_XTS_AES_UNIT_SIZE__LAST) || 147 if ((unit_size == CCP_XTS_AES_UNIT_SIZE__LAST) ||
141 (ctx->u.aes.key_len != AES_KEYSIZE_128)) { 148 (ctx->u.aes.key_len != AES_KEYSIZE_128)) {
142 /* Use the fallback to process the request for any 149 /* Use the fallback to process the request for any
143 * unsupported unit sizes or key sizes 150 * unsupported unit sizes or key sizes
@@ -158,7 +165,7 @@ static int ccp_aes_xts_crypt(struct ablkcipher_request *req,
158 rctx->cmd.engine = CCP_ENGINE_XTS_AES_128; 165 rctx->cmd.engine = CCP_ENGINE_XTS_AES_128;
159 rctx->cmd.u.xts.action = (encrypt) ? CCP_AES_ACTION_ENCRYPT 166 rctx->cmd.u.xts.action = (encrypt) ? CCP_AES_ACTION_ENCRYPT
160 : CCP_AES_ACTION_DECRYPT; 167 : CCP_AES_ACTION_DECRYPT;
161 rctx->cmd.u.xts.unit_size = unit_size_map[unit].value; 168 rctx->cmd.u.xts.unit_size = unit_size;
162 rctx->cmd.u.xts.key = &ctx->u.aes.key_sg; 169 rctx->cmd.u.xts.key = &ctx->u.aes.key_sg;
163 rctx->cmd.u.xts.key_len = ctx->u.aes.key_len; 170 rctx->cmd.u.xts.key_len = ctx->u.aes.key_len;
164 rctx->cmd.u.xts.iv = &rctx->iv_sg; 171 rctx->cmd.u.xts.iv = &rctx->iv_sg;
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 6eefaa2fe58f..63464e86f2b1 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1986,7 +1986,7 @@ err_algs:
1986 &dd->pdata->algs_info[i].algs_list[j]); 1986 &dd->pdata->algs_info[i].algs_list[j]);
1987err_pm: 1987err_pm:
1988 pm_runtime_disable(dev); 1988 pm_runtime_disable(dev);
1989 if (dd->polling_mode) 1989 if (!dd->polling_mode)
1990 dma_release_channel(dd->dma_lch); 1990 dma_release_channel(dd->dma_lch);
1991data_err: 1991data_err:
1992 dev_err(dev, "initialization failed.\n"); 1992 dev_err(dev, "initialization failed.\n");
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 4a2c07ee6677..6355ab38d630 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -33,6 +33,7 @@
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/poll.h> 34#include <linux/poll.h>
35#include <linux/reservation.h> 35#include <linux/reservation.h>
36#include <linux/mm.h>
36 37
37#include <uapi/linux/dma-buf.h> 38#include <uapi/linux/dma-buf.h>
38 39
@@ -90,7 +91,7 @@ static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
90 dmabuf = file->private_data; 91 dmabuf = file->private_data;
91 92
92 /* check for overflowing the buffer's size */ 93 /* check for overflowing the buffer's size */
93 if (vma->vm_pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > 94 if (vma->vm_pgoff + vma_pages(vma) >
94 dmabuf->size >> PAGE_SHIFT) 95 dmabuf->size >> PAGE_SHIFT)
95 return -EINVAL; 96 return -EINVAL;
96 97
@@ -723,11 +724,11 @@ int dma_buf_mmap(struct dma_buf *dmabuf, struct vm_area_struct *vma,
723 return -EINVAL; 724 return -EINVAL;
724 725
725 /* check for offset overflow */ 726 /* check for offset overflow */
726 if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) < pgoff) 727 if (pgoff + vma_pages(vma) < pgoff)
727 return -EOVERFLOW; 728 return -EOVERFLOW;
728 729
729 /* check for overflowing the buffer's size */ 730 /* check for overflowing the buffer's size */
730 if (pgoff + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) > 731 if (pgoff + vma_pages(vma) >
731 dmabuf->size >> PAGE_SHIFT) 732 dmabuf->size >> PAGE_SHIFT)
732 return -EINVAL; 733 return -EINVAL;
733 734
diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
index c0bd5722c997..9566a62ad8e3 100644
--- a/drivers/dma-buf/reservation.c
+++ b/drivers/dma-buf/reservation.c
@@ -35,6 +35,17 @@
35#include <linux/reservation.h> 35#include <linux/reservation.h>
36#include <linux/export.h> 36#include <linux/export.h>
37 37
38/**
39 * DOC: Reservation Object Overview
40 *
41 * The reservation object provides a mechanism to manage shared and
42 * exclusive fences associated with a buffer. A reservation object
43 * can have attached one exclusive fence (normally associated with
44 * write operations) or N shared fences (read operations). The RCU
45 * mechanism is used to protect read access to fences from locked
46 * write-side updates.
47 */
48
38DEFINE_WW_CLASS(reservation_ww_class); 49DEFINE_WW_CLASS(reservation_ww_class);
39EXPORT_SYMBOL(reservation_ww_class); 50EXPORT_SYMBOL(reservation_ww_class);
40 51
@@ -43,9 +54,17 @@ EXPORT_SYMBOL(reservation_seqcount_class);
43 54
44const char reservation_seqcount_string[] = "reservation_seqcount"; 55const char reservation_seqcount_string[] = "reservation_seqcount";
45EXPORT_SYMBOL(reservation_seqcount_string); 56EXPORT_SYMBOL(reservation_seqcount_string);
46/* 57
47 * Reserve space to add a shared fence to a reservation_object, 58/**
48 * must be called with obj->lock held. 59 * reservation_object_reserve_shared - Reserve space to add a shared
60 * fence to a reservation_object.
61 * @obj: reservation object
62 *
63 * Should be called before reservation_object_add_shared_fence(). Must
64 * be called with obj->lock held.
65 *
66 * RETURNS
67 * Zero for success, or -errno
49 */ 68 */
50int reservation_object_reserve_shared(struct reservation_object *obj) 69int reservation_object_reserve_shared(struct reservation_object *obj)
51{ 70{
@@ -180,7 +199,11 @@ done:
180 fence_put(old_fence); 199 fence_put(old_fence);
181} 200}
182 201
183/* 202/**
203 * reservation_object_add_shared_fence - Add a fence to a shared slot
204 * @obj: the reservation object
205 * @fence: the shared fence to add
206 *
184 * Add a fence to a shared slot, obj->lock must be held, and 207 * Add a fence to a shared slot, obj->lock must be held, and
185 * reservation_object_reserve_shared_fence has been called. 208 * reservation_object_reserve_shared_fence has been called.
186 */ 209 */
@@ -200,6 +223,13 @@ void reservation_object_add_shared_fence(struct reservation_object *obj,
200} 223}
201EXPORT_SYMBOL(reservation_object_add_shared_fence); 224EXPORT_SYMBOL(reservation_object_add_shared_fence);
202 225
226/**
227 * reservation_object_add_excl_fence - Add an exclusive fence.
228 * @obj: the reservation object
229 * @fence: the shared fence to add
230 *
231 * Add a fence to the exclusive slot. The obj->lock must be held.
232 */
203void reservation_object_add_excl_fence(struct reservation_object *obj, 233void reservation_object_add_excl_fence(struct reservation_object *obj,
204 struct fence *fence) 234 struct fence *fence)
205{ 235{
@@ -233,6 +263,18 @@ void reservation_object_add_excl_fence(struct reservation_object *obj,
233} 263}
234EXPORT_SYMBOL(reservation_object_add_excl_fence); 264EXPORT_SYMBOL(reservation_object_add_excl_fence);
235 265
266/**
267 * reservation_object_get_fences_rcu - Get an object's shared and exclusive
268 * fences without update side lock held
269 * @obj: the reservation object
270 * @pfence_excl: the returned exclusive fence (or NULL)
271 * @pshared_count: the number of shared fences returned
272 * @pshared: the array of shared fence ptrs returned (array is krealloc'd to
273 * the required size, and must be freed by caller)
274 *
275 * RETURNS
276 * Zero or -errno
277 */
236int reservation_object_get_fences_rcu(struct reservation_object *obj, 278int reservation_object_get_fences_rcu(struct reservation_object *obj,
237 struct fence **pfence_excl, 279 struct fence **pfence_excl,
238 unsigned *pshared_count, 280 unsigned *pshared_count,
@@ -319,6 +361,18 @@ unlock:
319} 361}
320EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu); 362EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu);
321 363
364/**
365 * reservation_object_wait_timeout_rcu - Wait on reservation's objects
366 * shared and/or exclusive fences.
367 * @obj: the reservation object
368 * @wait_all: if true, wait on all fences, else wait on just exclusive fence
369 * @intr: if true, do interruptible wait
370 * @timeout: timeout value in jiffies or zero to return immediately
371 *
372 * RETURNS
373 * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or
374 * greater than zer on success.
375 */
322long reservation_object_wait_timeout_rcu(struct reservation_object *obj, 376long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
323 bool wait_all, bool intr, 377 bool wait_all, bool intr,
324 unsigned long timeout) 378 unsigned long timeout)
@@ -416,6 +470,16 @@ reservation_object_test_signaled_single(struct fence *passed_fence)
416 return ret; 470 return ret;
417} 471}
418 472
473/**
474 * reservation_object_test_signaled_rcu - Test if a reservation object's
475 * fences have been signaled.
476 * @obj: the reservation object
477 * @test_all: if true, test all fences, otherwise only test the exclusive
478 * fence
479 *
480 * RETURNS
481 * true if all fences signaled, else false
482 */
419bool reservation_object_test_signaled_rcu(struct reservation_object *obj, 483bool reservation_object_test_signaled_rcu(struct reservation_object *obj,
420 bool test_all) 484 bool test_all)
421{ 485{
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c
index d39014daeef9..fc5f197906ac 100644
--- a/drivers/gpio/gpio-lpc32xx.c
+++ b/drivers/gpio/gpio-lpc32xx.c
@@ -29,7 +29,6 @@
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/platform.h> 31#include <mach/platform.h>
32#include <mach/irqs.h>
33 32
34#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000) 33#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000)
35#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004) 34#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004)
@@ -371,61 +370,16 @@ static int lpc32xx_gpio_request(struct gpio_chip *chip, unsigned pin)
371 370
372static int lpc32xx_gpio_to_irq_p01(struct gpio_chip *chip, unsigned offset) 371static int lpc32xx_gpio_to_irq_p01(struct gpio_chip *chip, unsigned offset)
373{ 372{
374 return IRQ_LPC32XX_P0_P1_IRQ; 373 return -ENXIO;
375} 374}
376 375
377static const char lpc32xx_gpio_to_irq_gpio_p3_table[] = {
378 IRQ_LPC32XX_GPIO_00,
379 IRQ_LPC32XX_GPIO_01,
380 IRQ_LPC32XX_GPIO_02,
381 IRQ_LPC32XX_GPIO_03,
382 IRQ_LPC32XX_GPIO_04,
383 IRQ_LPC32XX_GPIO_05,
384};
385
386static int lpc32xx_gpio_to_irq_gpio_p3(struct gpio_chip *chip, unsigned offset) 376static int lpc32xx_gpio_to_irq_gpio_p3(struct gpio_chip *chip, unsigned offset)
387{ 377{
388 if (offset < ARRAY_SIZE(lpc32xx_gpio_to_irq_gpio_p3_table))
389 return lpc32xx_gpio_to_irq_gpio_p3_table[offset];
390 return -ENXIO; 378 return -ENXIO;
391} 379}
392 380
393static const char lpc32xx_gpio_to_irq_gpi_p3_table[] = {
394 IRQ_LPC32XX_GPI_00,
395 IRQ_LPC32XX_GPI_01,
396 IRQ_LPC32XX_GPI_02,
397 IRQ_LPC32XX_GPI_03,
398 IRQ_LPC32XX_GPI_04,
399 IRQ_LPC32XX_GPI_05,
400 IRQ_LPC32XX_GPI_06,
401 IRQ_LPC32XX_GPI_07,
402 IRQ_LPC32XX_GPI_08,
403 IRQ_LPC32XX_GPI_09,
404 -ENXIO, /* 10 */
405 -ENXIO, /* 11 */
406 -ENXIO, /* 12 */
407 -ENXIO, /* 13 */
408 -ENXIO, /* 14 */
409 -ENXIO, /* 15 */
410 -ENXIO, /* 16 */
411 -ENXIO, /* 17 */
412 -ENXIO, /* 18 */
413 IRQ_LPC32XX_GPI_19,
414 -ENXIO, /* 20 */
415 -ENXIO, /* 21 */
416 -ENXIO, /* 22 */
417 -ENXIO, /* 23 */
418 -ENXIO, /* 24 */
419 -ENXIO, /* 25 */
420 -ENXIO, /* 26 */
421 -ENXIO, /* 27 */
422 IRQ_LPC32XX_GPI_28,
423};
424
425static int lpc32xx_gpio_to_irq_gpi_p3(struct gpio_chip *chip, unsigned offset) 381static int lpc32xx_gpio_to_irq_gpi_p3(struct gpio_chip *chip, unsigned offset)
426{ 382{
427 if (offset < ARRAY_SIZE(lpc32xx_gpio_to_irq_gpi_p3_table))
428 return lpc32xx_gpio_to_irq_gpi_p3_table[offset];
429 return -ENXIO; 383 return -ENXIO;
430} 384}
431 385
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d407f904a31c..24f60d28f0c0 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -20,6 +20,7 @@
20#include <linux/cdev.h> 20#include <linux/cdev.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/uaccess.h> 22#include <linux/uaccess.h>
23#include <linux/compat.h>
23#include <uapi/linux/gpio.h> 24#include <uapi/linux/gpio.h>
24 25
25#include "gpiolib.h" 26#include "gpiolib.h"
@@ -316,7 +317,7 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
316{ 317{
317 struct gpio_device *gdev = filp->private_data; 318 struct gpio_device *gdev = filp->private_data;
318 struct gpio_chip *chip = gdev->chip; 319 struct gpio_chip *chip = gdev->chip;
319 int __user *ip = (int __user *)arg; 320 void __user *ip = (void __user *)arg;
320 321
321 /* We fail any subsequent ioctl():s when the chip is gone */ 322 /* We fail any subsequent ioctl():s when the chip is gone */
322 if (!chip) 323 if (!chip)
@@ -388,6 +389,14 @@ static long gpio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
388 return -EINVAL; 389 return -EINVAL;
389} 390}
390 391
392#ifdef CONFIG_COMPAT
393static long gpio_ioctl_compat(struct file *filp, unsigned int cmd,
394 unsigned long arg)
395{
396 return gpio_ioctl(filp, cmd, (unsigned long)compat_ptr(arg));
397}
398#endif
399
391/** 400/**
392 * gpio_chrdev_open() - open the chardev for ioctl operations 401 * gpio_chrdev_open() - open the chardev for ioctl operations
393 * @inode: inode for this chardev 402 * @inode: inode for this chardev
@@ -431,7 +440,9 @@ static const struct file_operations gpio_fileops = {
431 .owner = THIS_MODULE, 440 .owner = THIS_MODULE,
432 .llseek = noop_llseek, 441 .llseek = noop_llseek,
433 .unlocked_ioctl = gpio_ioctl, 442 .unlocked_ioctl = gpio_ioctl,
434 .compat_ioctl = gpio_ioctl, 443#ifdef CONFIG_COMPAT
444 .compat_ioctl = gpio_ioctl_compat,
445#endif
435}; 446};
436 447
437static void gpiodevice_release(struct device *dev) 448static void gpiodevice_release(struct device *dev)
@@ -618,6 +629,8 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)
618 goto err_free_label; 629 goto err_free_label;
619 } 630 }
620 631
632 spin_unlock_irqrestore(&gpio_lock, flags);
633
621 for (i = 0; i < chip->ngpio; i++) { 634 for (i = 0; i < chip->ngpio; i++) {
622 struct gpio_desc *desc = &gdev->descs[i]; 635 struct gpio_desc *desc = &gdev->descs[i];
623 636
@@ -649,8 +662,6 @@ int gpiochip_add_data(struct gpio_chip *chip, void *data)
649 } 662 }
650 } 663 }
651 664
652 spin_unlock_irqrestore(&gpio_lock, flags);
653
654#ifdef CONFIG_PINCTRL 665#ifdef CONFIG_PINCTRL
655 INIT_LIST_HEAD(&gdev->pin_ranges); 666 INIT_LIST_HEAD(&gdev->pin_ranges);
656#endif 667#endif
@@ -1356,10 +1367,13 @@ done:
1356/* 1367/*
1357 * This descriptor validation needs to be inserted verbatim into each 1368 * This descriptor validation needs to be inserted verbatim into each
1358 * function taking a descriptor, so we need to use a preprocessor 1369 * function taking a descriptor, so we need to use a preprocessor
1359 * macro to avoid endless duplication. 1370 * macro to avoid endless duplication. If the desc is NULL it is an
1371 * optional GPIO and calls should just bail out.
1360 */ 1372 */
1361#define VALIDATE_DESC(desc) do { \ 1373#define VALIDATE_DESC(desc) do { \
1362 if (!desc || !desc->gdev) { \ 1374 if (!desc) \
1375 return 0; \
1376 if (!desc->gdev) { \
1363 pr_warn("%s: invalid GPIO\n", __func__); \ 1377 pr_warn("%s: invalid GPIO\n", __func__); \
1364 return -EINVAL; \ 1378 return -EINVAL; \
1365 } \ 1379 } \
@@ -1370,7 +1384,9 @@ done:
1370 } } while (0) 1384 } } while (0)
1371 1385
1372#define VALIDATE_DESC_VOID(desc) do { \ 1386#define VALIDATE_DESC_VOID(desc) do { \
1373 if (!desc || !desc->gdev) { \ 1387 if (!desc) \
1388 return; \
1389 if (!desc->gdev) { \
1374 pr_warn("%s: invalid GPIO\n", __func__); \ 1390 pr_warn("%s: invalid GPIO\n", __func__); \
1375 return; \ 1391 return; \
1376 } \ 1392 } \
@@ -2066,17 +2082,30 @@ EXPORT_SYMBOL_GPL(gpiod_to_irq);
2066 */ 2082 */
2067int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset) 2083int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
2068{ 2084{
2069 if (offset >= chip->ngpio) 2085 struct gpio_desc *desc;
2070 return -EINVAL; 2086
2087 desc = gpiochip_get_desc(chip, offset);
2088 if (IS_ERR(desc))
2089 return PTR_ERR(desc);
2090
2091 /* Flush direction if something changed behind our back */
2092 if (chip->get_direction) {
2093 int dir = chip->get_direction(chip, offset);
2094
2095 if (dir)
2096 clear_bit(FLAG_IS_OUT, &desc->flags);
2097 else
2098 set_bit(FLAG_IS_OUT, &desc->flags);
2099 }
2071 2100
2072 if (test_bit(FLAG_IS_OUT, &chip->gpiodev->descs[offset].flags)) { 2101 if (test_bit(FLAG_IS_OUT, &desc->flags)) {
2073 chip_err(chip, 2102 chip_err(chip,
2074 "%s: tried to flag a GPIO set as output for IRQ\n", 2103 "%s: tried to flag a GPIO set as output for IRQ\n",
2075 __func__); 2104 __func__);
2076 return -EIO; 2105 return -EIO;
2077 } 2106 }
2078 2107
2079 set_bit(FLAG_USED_AS_IRQ, &chip->gpiodev->descs[offset].flags); 2108 set_bit(FLAG_USED_AS_IRQ, &desc->flags);
2080 return 0; 2109 return 0;
2081} 2110}
2082EXPORT_SYMBOL_GPL(gpiochip_lock_as_irq); 2111EXPORT_SYMBOL_GPL(gpiochip_lock_as_irq);
diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c
index 69b5be0f9fb8..7675bbc70133 100644
--- a/drivers/gpu/drm/arc/arcpgu_drv.c
+++ b/drivers/gpu/drm/arc/arcpgu_drv.c
@@ -207,7 +207,7 @@ static struct drm_driver arcpgu_drm_driver = {
207 .get_vblank_counter = drm_vblank_no_hw_counter, 207 .get_vblank_counter = drm_vblank_no_hw_counter,
208 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 208 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
209 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 209 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
210 .gem_free_object = drm_gem_cma_free_object, 210 .gem_free_object_unlocked = drm_gem_cma_free_object,
211 .gem_vm_ops = &drm_gem_cma_vm_ops, 211 .gem_vm_ops = &drm_gem_cma_vm_ops,
212 .gem_prime_export = drm_gem_prime_export, 212 .gem_prime_export = drm_gem_prime_export,
213 .gem_prime_import = drm_gem_prime_import, 213 .gem_prime_import = drm_gem_prime_import,
diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c
index b44f72722764..48019ae22ddb 100644
--- a/drivers/gpu/drm/arm/hdlcd_crtc.c
+++ b/drivers/gpu/drm/arm/hdlcd_crtc.c
@@ -33,8 +33,17 @@
33 * 33 *
34 */ 34 */
35 35
36static void hdlcd_crtc_cleanup(struct drm_crtc *crtc)
37{
38 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
39
40 /* stop the controller on cleanup */
41 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
42 drm_crtc_cleanup(crtc);
43}
44
36static const struct drm_crtc_funcs hdlcd_crtc_funcs = { 45static const struct drm_crtc_funcs hdlcd_crtc_funcs = {
37 .destroy = drm_crtc_cleanup, 46 .destroy = hdlcd_crtc_cleanup,
38 .set_config = drm_atomic_helper_set_config, 47 .set_config = drm_atomic_helper_set_config,
39 .page_flip = drm_atomic_helper_page_flip, 48 .page_flip = drm_atomic_helper_page_flip,
40 .reset = drm_atomic_helper_crtc_reset, 49 .reset = drm_atomic_helper_crtc_reset,
@@ -97,7 +106,7 @@ static void hdlcd_crtc_mode_set_nofb(struct drm_crtc *crtc)
97 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 106 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
98 struct drm_display_mode *m = &crtc->state->adjusted_mode; 107 struct drm_display_mode *m = &crtc->state->adjusted_mode;
99 struct videomode vm; 108 struct videomode vm;
100 unsigned int polarities, line_length, err; 109 unsigned int polarities, err;
101 110
102 vm.vfront_porch = m->crtc_vsync_start - m->crtc_vdisplay; 111 vm.vfront_porch = m->crtc_vsync_start - m->crtc_vdisplay;
103 vm.vback_porch = m->crtc_vtotal - m->crtc_vsync_end; 112 vm.vback_porch = m->crtc_vtotal - m->crtc_vsync_end;
@@ -113,23 +122,18 @@ static void hdlcd_crtc_mode_set_nofb(struct drm_crtc *crtc)
113 if (m->flags & DRM_MODE_FLAG_PVSYNC) 122 if (m->flags & DRM_MODE_FLAG_PVSYNC)
114 polarities |= HDLCD_POLARITY_VSYNC; 123 polarities |= HDLCD_POLARITY_VSYNC;
115 124
116 line_length = crtc->primary->state->fb->pitches[0];
117
118 /* Allow max number of outstanding requests and largest burst size */ 125 /* Allow max number of outstanding requests and largest burst size */
119 hdlcd_write(hdlcd, HDLCD_REG_BUS_OPTIONS, 126 hdlcd_write(hdlcd, HDLCD_REG_BUS_OPTIONS,
120 HDLCD_BUS_MAX_OUTSTAND | HDLCD_BUS_BURST_16); 127 HDLCD_BUS_MAX_OUTSTAND | HDLCD_BUS_BURST_16);
121 128
122 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, line_length);
123 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, line_length);
124 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, m->crtc_vdisplay - 1);
125 hdlcd_write(hdlcd, HDLCD_REG_V_DATA, m->crtc_vdisplay - 1); 129 hdlcd_write(hdlcd, HDLCD_REG_V_DATA, m->crtc_vdisplay - 1);
126 hdlcd_write(hdlcd, HDLCD_REG_V_BACK_PORCH, vm.vback_porch - 1); 130 hdlcd_write(hdlcd, HDLCD_REG_V_BACK_PORCH, vm.vback_porch - 1);
127 hdlcd_write(hdlcd, HDLCD_REG_V_FRONT_PORCH, vm.vfront_porch - 1); 131 hdlcd_write(hdlcd, HDLCD_REG_V_FRONT_PORCH, vm.vfront_porch - 1);
128 hdlcd_write(hdlcd, HDLCD_REG_V_SYNC, vm.vsync_len - 1); 132 hdlcd_write(hdlcd, HDLCD_REG_V_SYNC, vm.vsync_len - 1);
133 hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
129 hdlcd_write(hdlcd, HDLCD_REG_H_BACK_PORCH, vm.hback_porch - 1); 134 hdlcd_write(hdlcd, HDLCD_REG_H_BACK_PORCH, vm.hback_porch - 1);
130 hdlcd_write(hdlcd, HDLCD_REG_H_FRONT_PORCH, vm.hfront_porch - 1); 135 hdlcd_write(hdlcd, HDLCD_REG_H_FRONT_PORCH, vm.hfront_porch - 1);
131 hdlcd_write(hdlcd, HDLCD_REG_H_SYNC, vm.hsync_len - 1); 136 hdlcd_write(hdlcd, HDLCD_REG_H_SYNC, vm.hsync_len - 1);
132 hdlcd_write(hdlcd, HDLCD_REG_H_DATA, m->crtc_hdisplay - 1);
133 hdlcd_write(hdlcd, HDLCD_REG_POLARITIES, polarities); 137 hdlcd_write(hdlcd, HDLCD_REG_POLARITIES, polarities);
134 138
135 err = hdlcd_set_pxl_fmt(crtc); 139 err = hdlcd_set_pxl_fmt(crtc);
@@ -144,20 +148,19 @@ static void hdlcd_crtc_enable(struct drm_crtc *crtc)
144 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 148 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
145 149
146 clk_prepare_enable(hdlcd->clk); 150 clk_prepare_enable(hdlcd->clk);
151 hdlcd_crtc_mode_set_nofb(crtc);
147 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1); 152 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 1);
148 drm_crtc_vblank_on(crtc);
149} 153}
150 154
151static void hdlcd_crtc_disable(struct drm_crtc *crtc) 155static void hdlcd_crtc_disable(struct drm_crtc *crtc)
152{ 156{
153 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 157 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc);
154 158
155 if (!crtc->primary->fb) 159 if (!crtc->state->active)
156 return; 160 return;
157 161
158 clk_disable_unprepare(hdlcd->clk);
159 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0); 162 hdlcd_write(hdlcd, HDLCD_REG_COMMAND, 0);
160 drm_crtc_vblank_off(crtc); 163 clk_disable_unprepare(hdlcd->clk);
161} 164}
162 165
163static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc, 166static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
@@ -179,20 +182,17 @@ static int hdlcd_crtc_atomic_check(struct drm_crtc *crtc,
179static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc, 182static void hdlcd_crtc_atomic_begin(struct drm_crtc *crtc,
180 struct drm_crtc_state *state) 183 struct drm_crtc_state *state)
181{ 184{
182 struct hdlcd_drm_private *hdlcd = crtc_to_hdlcd_priv(crtc); 185 struct drm_pending_vblank_event *event = crtc->state->event;
183 unsigned long flags;
184
185 if (crtc->state->event) {
186 struct drm_pending_vblank_event *event = crtc->state->event;
187 186
187 if (event) {
188 crtc->state->event = NULL; 188 crtc->state->event = NULL;
189 event->pipe = drm_crtc_index(crtc);
190
191 WARN_ON(drm_crtc_vblank_get(crtc) != 0);
192 189
193 spin_lock_irqsave(&crtc->dev->event_lock, flags); 190 spin_lock_irq(&crtc->dev->event_lock);
194 list_add_tail(&event->base.link, &hdlcd->event_list); 191 if (drm_crtc_vblank_get(crtc) == 0)
195 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 192 drm_crtc_arm_vblank_event(crtc, event);
193 else
194 drm_crtc_send_vblank_event(crtc, event);
195 spin_unlock_irq(&crtc->dev->event_lock);
196 } 196 }
197} 197}
198 198
@@ -206,6 +206,15 @@ static const struct drm_crtc_helper_funcs hdlcd_crtc_helper_funcs = {
206static int hdlcd_plane_atomic_check(struct drm_plane *plane, 206static int hdlcd_plane_atomic_check(struct drm_plane *plane,
207 struct drm_plane_state *state) 207 struct drm_plane_state *state)
208{ 208{
209 u32 src_w, src_h;
210
211 src_w = state->src_w >> 16;
212 src_h = state->src_h >> 16;
213
214 /* we can't do any scaling of the plane source */
215 if ((src_w != state->crtc_w) || (src_h != state->crtc_h))
216 return -EINVAL;
217
209 return 0; 218 return 0;
210} 219}
211 220
@@ -214,20 +223,31 @@ static void hdlcd_plane_atomic_update(struct drm_plane *plane,
214{ 223{
215 struct hdlcd_drm_private *hdlcd; 224 struct hdlcd_drm_private *hdlcd;
216 struct drm_gem_cma_object *gem; 225 struct drm_gem_cma_object *gem;
226 unsigned int depth, bpp;
227 u32 src_w, src_h, dest_w, dest_h;
217 dma_addr_t scanout_start; 228 dma_addr_t scanout_start;
218 229
219 if (!plane->state->crtc || !plane->state->fb) 230 if (!plane->state->fb)
220 return; 231 return;
221 232
222 hdlcd = crtc_to_hdlcd_priv(plane->state->crtc); 233 drm_fb_get_bpp_depth(plane->state->fb->pixel_format, &depth, &bpp);
234 src_w = plane->state->src_w >> 16;
235 src_h = plane->state->src_h >> 16;
236 dest_w = plane->state->crtc_w;
237 dest_h = plane->state->crtc_h;
223 gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0); 238 gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0);
224 scanout_start = gem->paddr; 239 scanout_start = gem->paddr + plane->state->fb->offsets[0] +
240 plane->state->crtc_y * plane->state->fb->pitches[0] +
241 plane->state->crtc_x * bpp / 8;
242
243 hdlcd = plane->dev->dev_private;
244 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_LENGTH, plane->state->fb->pitches[0]);
245 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_PITCH, plane->state->fb->pitches[0]);
246 hdlcd_write(hdlcd, HDLCD_REG_FB_LINE_COUNT, dest_h - 1);
225 hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start); 247 hdlcd_write(hdlcd, HDLCD_REG_FB_BASE, scanout_start);
226} 248}
227 249
228static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = { 250static const struct drm_plane_helper_funcs hdlcd_plane_helper_funcs = {
229 .prepare_fb = NULL,
230 .cleanup_fb = NULL,
231 .atomic_check = hdlcd_plane_atomic_check, 251 .atomic_check = hdlcd_plane_atomic_check,
232 .atomic_update = hdlcd_plane_atomic_update, 252 .atomic_update = hdlcd_plane_atomic_update,
233}; 253};
@@ -275,16 +295,6 @@ static struct drm_plane *hdlcd_plane_init(struct drm_device *drm)
275 return plane; 295 return plane;
276} 296}
277 297
278void hdlcd_crtc_suspend(struct drm_crtc *crtc)
279{
280 hdlcd_crtc_disable(crtc);
281}
282
283void hdlcd_crtc_resume(struct drm_crtc *crtc)
284{
285 hdlcd_crtc_enable(crtc);
286}
287
288int hdlcd_setup_crtc(struct drm_device *drm) 298int hdlcd_setup_crtc(struct drm_device *drm)
289{ 299{
290 struct hdlcd_drm_private *hdlcd = drm->dev_private; 300 struct hdlcd_drm_private *hdlcd = drm->dev_private;
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 4f909378d581..49e586d67595 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -49,8 +49,6 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
49 atomic_set(&hdlcd->dma_end_count, 0); 49 atomic_set(&hdlcd->dma_end_count, 0);
50#endif 50#endif
51 51
52 INIT_LIST_HEAD(&hdlcd->event_list);
53
54 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 52 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
55 hdlcd->mmio = devm_ioremap_resource(drm->dev, res); 53 hdlcd->mmio = devm_ioremap_resource(drm->dev, res);
56 if (IS_ERR(hdlcd->mmio)) { 54 if (IS_ERR(hdlcd->mmio)) {
@@ -84,11 +82,7 @@ static int hdlcd_load(struct drm_device *drm, unsigned long flags)
84 goto setup_fail; 82 goto setup_fail;
85 } 83 }
86 84
87 pm_runtime_enable(drm->dev);
88
89 pm_runtime_get_sync(drm->dev);
90 ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); 85 ret = drm_irq_install(drm, platform_get_irq(pdev, 0));
91 pm_runtime_put_sync(drm->dev);
92 if (ret < 0) { 86 if (ret < 0) {
93 DRM_ERROR("failed to install IRQ handler\n"); 87 DRM_ERROR("failed to install IRQ handler\n");
94 goto irq_fail; 88 goto irq_fail;
@@ -164,24 +158,9 @@ static irqreturn_t hdlcd_irq(int irq, void *arg)
164 atomic_inc(&hdlcd->vsync_count); 158 atomic_inc(&hdlcd->vsync_count);
165 159
166#endif 160#endif
167 if (irq_status & HDLCD_INTERRUPT_VSYNC) { 161 if (irq_status & HDLCD_INTERRUPT_VSYNC)
168 bool events_sent = false;
169 unsigned long flags;
170 struct drm_pending_vblank_event *e, *t;
171
172 drm_crtc_handle_vblank(&hdlcd->crtc); 162 drm_crtc_handle_vblank(&hdlcd->crtc);
173 163
174 spin_lock_irqsave(&drm->event_lock, flags);
175 list_for_each_entry_safe(e, t, &hdlcd->event_list, base.link) {
176 list_del(&e->base.link);
177 drm_crtc_send_vblank_event(&hdlcd->crtc, e);
178 events_sent = true;
179 }
180 if (events_sent)
181 drm_crtc_vblank_put(&hdlcd->crtc);
182 spin_unlock_irqrestore(&drm->event_lock, flags);
183 }
184
185 /* acknowledge interrupt(s) */ 164 /* acknowledge interrupt(s) */
186 hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status); 165 hdlcd_write(hdlcd, HDLCD_REG_INT_CLEAR, irq_status);
187 166
@@ -275,6 +254,7 @@ static int hdlcd_show_pxlclock(struct seq_file *m, void *arg)
275static struct drm_info_list hdlcd_debugfs_list[] = { 254static struct drm_info_list hdlcd_debugfs_list[] = {
276 { "interrupt_count", hdlcd_show_underrun_count, 0 }, 255 { "interrupt_count", hdlcd_show_underrun_count, 0 },
277 { "clocks", hdlcd_show_pxlclock, 0 }, 256 { "clocks", hdlcd_show_pxlclock, 0 },
257 { "fb", drm_fb_cma_debugfs_show, 0 },
278}; 258};
279 259
280static int hdlcd_debugfs_init(struct drm_minor *minor) 260static int hdlcd_debugfs_init(struct drm_minor *minor)
@@ -357,6 +337,8 @@ static int hdlcd_drm_bind(struct device *dev)
357 return -ENOMEM; 337 return -ENOMEM;
358 338
359 drm->dev_private = hdlcd; 339 drm->dev_private = hdlcd;
340 dev_set_drvdata(dev, drm);
341
360 hdlcd_setup_mode_config(drm); 342 hdlcd_setup_mode_config(drm);
361 ret = hdlcd_load(drm, 0); 343 ret = hdlcd_load(drm, 0);
362 if (ret) 344 if (ret)
@@ -366,14 +348,18 @@ static int hdlcd_drm_bind(struct device *dev)
366 if (ret) 348 if (ret)
367 goto err_unload; 349 goto err_unload;
368 350
369 dev_set_drvdata(dev, drm);
370
371 ret = component_bind_all(dev, drm); 351 ret = component_bind_all(dev, drm);
372 if (ret) { 352 if (ret) {
373 DRM_ERROR("Failed to bind all components\n"); 353 DRM_ERROR("Failed to bind all components\n");
374 goto err_unregister; 354 goto err_unregister;
375 } 355 }
376 356
357 ret = pm_runtime_set_active(dev);
358 if (ret)
359 goto err_pm_active;
360
361 pm_runtime_enable(dev);
362
377 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); 363 ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
378 if (ret < 0) { 364 if (ret < 0) {
379 DRM_ERROR("failed to initialise vblank\n"); 365 DRM_ERROR("failed to initialise vblank\n");
@@ -399,16 +385,16 @@ err_fbdev:
399 drm_mode_config_cleanup(drm); 385 drm_mode_config_cleanup(drm);
400 drm_vblank_cleanup(drm); 386 drm_vblank_cleanup(drm);
401err_vblank: 387err_vblank:
388 pm_runtime_disable(drm->dev);
389err_pm_active:
402 component_unbind_all(dev, drm); 390 component_unbind_all(dev, drm);
403err_unregister: 391err_unregister:
404 drm_dev_unregister(drm); 392 drm_dev_unregister(drm);
405err_unload: 393err_unload:
406 pm_runtime_get_sync(drm->dev);
407 drm_irq_uninstall(drm); 394 drm_irq_uninstall(drm);
408 pm_runtime_put_sync(drm->dev);
409 pm_runtime_disable(drm->dev);
410 of_reserved_mem_device_release(drm->dev); 395 of_reserved_mem_device_release(drm->dev);
411err_free: 396err_free:
397 dev_set_drvdata(dev, NULL);
412 drm_dev_unref(drm); 398 drm_dev_unref(drm);
413 399
414 return ret; 400 return ret;
@@ -495,30 +481,34 @@ MODULE_DEVICE_TABLE(of, hdlcd_of_match);
495static int __maybe_unused hdlcd_pm_suspend(struct device *dev) 481static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
496{ 482{
497 struct drm_device *drm = dev_get_drvdata(dev); 483 struct drm_device *drm = dev_get_drvdata(dev);
498 struct drm_crtc *crtc; 484 struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
499 485
500 if (pm_runtime_suspended(dev)) 486 if (!hdlcd)
501 return 0; 487 return 0;
502 488
503 drm_modeset_lock_all(drm); 489 drm_kms_helper_poll_disable(drm);
504 list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) 490
505 hdlcd_crtc_suspend(crtc); 491 hdlcd->state = drm_atomic_helper_suspend(drm);
506 drm_modeset_unlock_all(drm); 492 if (IS_ERR(hdlcd->state)) {
493 drm_kms_helper_poll_enable(drm);
494 return PTR_ERR(hdlcd->state);
495 }
496
507 return 0; 497 return 0;
508} 498}
509 499
510static int __maybe_unused hdlcd_pm_resume(struct device *dev) 500static int __maybe_unused hdlcd_pm_resume(struct device *dev)
511{ 501{
512 struct drm_device *drm = dev_get_drvdata(dev); 502 struct drm_device *drm = dev_get_drvdata(dev);
513 struct drm_crtc *crtc; 503 struct hdlcd_drm_private *hdlcd = drm ? drm->dev_private : NULL;
514 504
515 if (!pm_runtime_suspended(dev)) 505 if (!hdlcd)
516 return 0; 506 return 0;
517 507
518 drm_modeset_lock_all(drm); 508 drm_atomic_helper_resume(drm, hdlcd->state);
519 list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) 509 drm_kms_helper_poll_enable(drm);
520 hdlcd_crtc_resume(crtc); 510 pm_runtime_set_active(dev);
521 drm_modeset_unlock_all(drm); 511
522 return 0; 512 return 0;
523} 513}
524 514
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.h b/drivers/gpu/drm/arm/hdlcd_drv.h
index aa234784f053..e3950a071152 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.h
+++ b/drivers/gpu/drm/arm/hdlcd_drv.h
@@ -9,10 +9,9 @@ struct hdlcd_drm_private {
9 void __iomem *mmio; 9 void __iomem *mmio;
10 struct clk *clk; 10 struct clk *clk;
11 struct drm_fbdev_cma *fbdev; 11 struct drm_fbdev_cma *fbdev;
12 struct drm_framebuffer *fb;
13 struct list_head event_list;
14 struct drm_crtc crtc; 12 struct drm_crtc crtc;
15 struct drm_plane *plane; 13 struct drm_plane *plane;
14 struct drm_atomic_state *state;
16#ifdef CONFIG_DEBUG_FS 15#ifdef CONFIG_DEBUG_FS
17 atomic_t buffer_underrun_count; 16 atomic_t buffer_underrun_count;
18 atomic_t bus_error_count; 17 atomic_t bus_error_count;
@@ -36,7 +35,5 @@ static inline u32 hdlcd_read(struct hdlcd_drm_private *hdlcd, unsigned int reg)
36 35
37int hdlcd_setup_crtc(struct drm_device *dev); 36int hdlcd_setup_crtc(struct drm_device *dev);
38void hdlcd_set_scanout(struct hdlcd_drm_private *hdlcd); 37void hdlcd_set_scanout(struct hdlcd_drm_private *hdlcd);
39void hdlcd_crtc_suspend(struct drm_crtc *crtc);
40void hdlcd_crtc_resume(struct drm_crtc *crtc);
41 38
42#endif /* __HDLCD_DRV_H__ */ 39#endif /* __HDLCD_DRV_H__ */
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 439824a61aa5..cb21c0b6374a 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -197,7 +197,7 @@ static struct drm_driver armada_drm_driver = {
197 .debugfs_init = armada_drm_debugfs_init, 197 .debugfs_init = armada_drm_debugfs_init,
198 .debugfs_cleanup = armada_drm_debugfs_cleanup, 198 .debugfs_cleanup = armada_drm_debugfs_cleanup,
199#endif 199#endif
200 .gem_free_object = armada_gem_free_object, 200 .gem_free_object_unlocked = armada_gem_free_object,
201 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 201 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
202 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 202 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
203 .gem_prime_export = armada_gem_prime_export, 203 .gem_prime_export = armada_gem_prime_export,
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index fcd9c0714836..f54afd2113a9 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -209,7 +209,7 @@ static struct drm_driver driver = {
209 .minor = DRIVER_MINOR, 209 .minor = DRIVER_MINOR,
210 .patchlevel = DRIVER_PATCHLEVEL, 210 .patchlevel = DRIVER_PATCHLEVEL,
211 211
212 .gem_free_object = ast_gem_free_object, 212 .gem_free_object_unlocked = ast_gem_free_object,
213 .dumb_create = ast_dumb_create, 213 .dumb_create = ast_dumb_create,
214 .dumb_map_offset = ast_dumb_mmap_offset, 214 .dumb_map_offset = ast_dumb_mmap_offset,
215 .dumb_destroy = drm_gem_dumb_destroy, 215 .dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 461b39c9bf70..613f6c99b76a 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -391,12 +391,11 @@ void atmel_hlcdc_crtc_reset(struct drm_crtc *crtc)
391{ 391{
392 struct atmel_hlcdc_crtc_state *state; 392 struct atmel_hlcdc_crtc_state *state;
393 393
394 if (crtc->state && crtc->state->mode_blob)
395 drm_property_unreference_blob(crtc->state->mode_blob);
396
397 if (crtc->state) { 394 if (crtc->state) {
395 __drm_atomic_helper_crtc_destroy_state(crtc->state);
398 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 396 state = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
399 kfree(state); 397 kfree(state);
398 crtc->state = NULL;
400 } 399 }
401 400
402 state = kzalloc(sizeof(*state), GFP_KERNEL); 401 state = kzalloc(sizeof(*state), GFP_KERNEL);
@@ -415,8 +414,9 @@ atmel_hlcdc_crtc_duplicate_state(struct drm_crtc *crtc)
415 return NULL; 414 return NULL;
416 415
417 state = kmalloc(sizeof(*state), GFP_KERNEL); 416 state = kmalloc(sizeof(*state), GFP_KERNEL);
418 if (state) 417 if (!state)
419 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); 418 return NULL;
419 __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
420 420
421 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state); 421 cur = drm_crtc_state_to_atmel_hlcdc_crtc_state(crtc->state);
422 state->output_mode = cur->output_mode; 422 state->output_mode = cur->output_mode;
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 8ded7645747e..6485fa5bee8b 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -776,7 +776,7 @@ static struct drm_driver atmel_hlcdc_dc_driver = {
776 .get_vblank_counter = drm_vblank_no_hw_counter, 776 .get_vblank_counter = drm_vblank_no_hw_counter,
777 .enable_vblank = atmel_hlcdc_dc_enable_vblank, 777 .enable_vblank = atmel_hlcdc_dc_enable_vblank,
778 .disable_vblank = atmel_hlcdc_dc_disable_vblank, 778 .disable_vblank = atmel_hlcdc_dc_disable_vblank,
779 .gem_free_object = drm_gem_cma_free_object, 779 .gem_free_object_unlocked = drm_gem_cma_free_object,
780 .gem_vm_ops = &drm_gem_cma_vm_ops, 780 .gem_vm_ops = &drm_gem_cma_vm_ops,
781 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 781 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
782 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 782 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index b332b4d3b0e2..abace82de6ea 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -89,7 +89,7 @@ static struct drm_driver bochs_driver = {
89 .date = "20130925", 89 .date = "20130925",
90 .major = 1, 90 .major = 1,
91 .minor = 0, 91 .minor = 0,
92 .gem_free_object = bochs_gem_free_object, 92 .gem_free_object_unlocked = bochs_gem_free_object,
93 .dumb_create = bochs_dumb_create, 93 .dumb_create = bochs_dumb_create,
94 .dumb_map_offset = bochs_dumb_mmap_offset, 94 .dumb_map_offset = bochs_dumb_mmap_offset,
95 .dumb_destroy = drm_gem_dumb_destroy, 95 .dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index dc83f69da6f1..b05f7eae32ce 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -142,7 +142,7 @@ static struct drm_driver driver = {
142 .major = DRIVER_MAJOR, 142 .major = DRIVER_MAJOR,
143 .minor = DRIVER_MINOR, 143 .minor = DRIVER_MINOR,
144 .patchlevel = DRIVER_PATCHLEVEL, 144 .patchlevel = DRIVER_PATCHLEVEL,
145 .gem_free_object = cirrus_gem_free_object, 145 .gem_free_object_unlocked = cirrus_gem_free_object,
146 .dumb_create = cirrus_dumb_create, 146 .dumb_create = cirrus_dumb_create,
147 .dumb_map_offset = cirrus_dumb_mmap_offset, 147 .dumb_map_offset = cirrus_dumb_mmap_offset,
148 .dumb_destroy = drm_gem_dumb_destroy, 148 .dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 1db198df3014..5e4b820a977c 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -340,6 +340,8 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
340 drm_property_unreference_blob(state->mode_blob); 340 drm_property_unreference_blob(state->mode_blob);
341 state->mode_blob = NULL; 341 state->mode_blob = NULL;
342 342
343 memset(&state->mode, 0, sizeof(state->mode));
344
343 if (blob) { 345 if (blob) {
344 if (blob->length != sizeof(struct drm_mode_modeinfo) || 346 if (blob->length != sizeof(struct drm_mode_modeinfo) ||
345 drm_mode_convert_umode(&state->mode, 347 drm_mode_convert_umode(&state->mode,
@@ -352,7 +354,6 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
352 DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n", 354 DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
353 state->mode.name, state); 355 state->mode.name, state);
354 } else { 356 } else {
355 memset(&state->mode, 0, sizeof(state->mode));
356 state->enable = false; 357 state->enable = false;
357 DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n", 358 DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
358 state); 359 state);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 889e01f1b3f2..da2f28ea5fad 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2765,8 +2765,6 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
2765 goto out; 2765 goto out;
2766 } 2766 }
2767 2767
2768 drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
2769
2770 /* 2768 /*
2771 * Check whether the primary plane supports the fb pixel format. 2769 * Check whether the primary plane supports the fb pixel format.
2772 * Drivers not implementing the universal planes API use a 2770 * Drivers not implementing the universal planes API use a
@@ -4785,7 +4783,8 @@ bool drm_property_change_valid_get(struct drm_property *property,
4785 if (value == 0) 4783 if (value == 0)
4786 return true; 4784 return true;
4787 4785
4788 return _object_find(property->dev, value, property->values[0]) != NULL; 4786 *ref = _object_find(property->dev, value, property->values[0]);
4787 return *ref != NULL;
4789 } 4788 }
4790 4789
4791 for (i = 0; i < property->num_values; i++) 4790 for (i = 0; i < property->num_values; i++)
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index b6808020dd21..2e7ef0b325e2 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -458,7 +458,7 @@ err_cma_destroy:
458err_fb_info_destroy: 458err_fb_info_destroy:
459 drm_fb_helper_release_fbi(helper); 459 drm_fb_helper_release_fbi(helper);
460err_gem_free_object: 460err_gem_free_object:
461 dev->driver->gem_free_object(&obj->base); 461 drm_gem_object_unreference_unlocked(&obj->base);
462 return ret; 462 return ret;
463} 463}
464EXPORT_SYMBOL(drm_fbdev_cma_create_with_funcs); 464EXPORT_SYMBOL(drm_fbdev_cma_create_with_funcs);
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index e1ab008b3f08..1d6c335584ec 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -121,7 +121,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
121 return cma_obj; 121 return cma_obj;
122 122
123error: 123error:
124 drm->driver->gem_free_object(&cma_obj->base); 124 drm_gem_object_unreference_unlocked(&cma_obj->base);
125 return ERR_PTR(ret); 125 return ERR_PTR(ret);
126} 126}
127EXPORT_SYMBOL_GPL(drm_gem_cma_create); 127EXPORT_SYMBOL_GPL(drm_gem_cma_create);
@@ -162,18 +162,12 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
162 * and handle has the id what user can see. 162 * and handle has the id what user can see.
163 */ 163 */
164 ret = drm_gem_handle_create(file_priv, gem_obj, handle); 164 ret = drm_gem_handle_create(file_priv, gem_obj, handle);
165 if (ret)
166 goto err_handle_create;
167
168 /* drop reference from allocate - handle holds it now. */ 165 /* drop reference from allocate - handle holds it now. */
169 drm_gem_object_unreference_unlocked(gem_obj); 166 drm_gem_object_unreference_unlocked(gem_obj);
167 if (ret)
168 return ERR_PTR(ret);
170 169
171 return cma_obj; 170 return cma_obj;
172
173err_handle_create:
174 drm->driver->gem_free_object(gem_obj);
175
176 return ERR_PTR(ret);
177} 171}
178 172
179/** 173/**
diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index f8f70c85b648..fc5040ae5f25 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1520,6 +1520,8 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
1520 if (out->status != MODE_OK) 1520 if (out->status != MODE_OK)
1521 goto out; 1521 goto out;
1522 1522
1523 drm_mode_set_crtcinfo(out, CRTC_INTERLACE_HALVE_V);
1524
1523 ret = 0; 1525 ret = 0;
1524 1526
1525out: 1527out:
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 0ec1ad961e0d..33727d5d826a 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -198,7 +198,7 @@ static struct drm_driver fsl_dcu_drm_driver = {
198 .get_vblank_counter = drm_vblank_no_hw_counter, 198 .get_vblank_counter = drm_vblank_no_hw_counter,
199 .enable_vblank = fsl_dcu_drm_enable_vblank, 199 .enable_vblank = fsl_dcu_drm_enable_vblank,
200 .disable_vblank = fsl_dcu_drm_disable_vblank, 200 .disable_vblank = fsl_dcu_drm_disable_vblank,
201 .gem_free_object = drm_gem_cma_free_object, 201 .gem_free_object_unlocked = drm_gem_cma_free_object,
202 .gem_vm_ops = &drm_gem_cma_vm_ops, 202 .gem_vm_ops = &drm_gem_cma_vm_ops,
203 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 203 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
204 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 204 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 1f14b602882b..82656654fb21 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -97,8 +97,8 @@ static struct imx_drm_crtc *imx_drm_find_crtc(struct drm_crtc *crtc)
97 return NULL; 97 return NULL;
98} 98}
99 99
100int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format, 100int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
101 int hsync_pin, int vsync_pin) 101 int hsync_pin, int vsync_pin, u32 bus_flags)
102{ 102{
103 struct imx_drm_crtc_helper_funcs *helper; 103 struct imx_drm_crtc_helper_funcs *helper;
104 struct imx_drm_crtc *imx_crtc; 104 struct imx_drm_crtc *imx_crtc;
@@ -110,14 +110,17 @@ int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, u32 bus_format,
110 helper = &imx_crtc->imx_drm_helper_funcs; 110 helper = &imx_crtc->imx_drm_helper_funcs;
111 if (helper->set_interface_pix_fmt) 111 if (helper->set_interface_pix_fmt)
112 return helper->set_interface_pix_fmt(encoder->crtc, 112 return helper->set_interface_pix_fmt(encoder->crtc,
113 bus_format, hsync_pin, vsync_pin); 113 bus_format, hsync_pin, vsync_pin,
114 bus_flags);
114 return 0; 115 return 0;
115} 116}
116EXPORT_SYMBOL_GPL(imx_drm_set_bus_format_pins); 117EXPORT_SYMBOL_GPL(imx_drm_set_bus_config);
117 118
118int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format) 119int imx_drm_set_bus_format(struct drm_encoder *encoder, u32 bus_format)
119{ 120{
120 return imx_drm_set_bus_format_pins(encoder, bus_format, 2, 3); 121 return imx_drm_set_bus_config(encoder, bus_format, 2, 3,
122 DRM_BUS_FLAG_DE_HIGH |
123 DRM_BUS_FLAG_PIXDATA_NEGEDGE);
121} 124}
122EXPORT_SYMBOL_GPL(imx_drm_set_bus_format); 125EXPORT_SYMBOL_GPL(imx_drm_set_bus_format);
123 126
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h
index b0241b9d1334..74320a1723b7 100644
--- a/drivers/gpu/drm/imx/imx-drm.h
+++ b/drivers/gpu/drm/imx/imx-drm.h
@@ -19,7 +19,8 @@ struct imx_drm_crtc_helper_funcs {
19 int (*enable_vblank)(struct drm_crtc *crtc); 19 int (*enable_vblank)(struct drm_crtc *crtc);
20 void (*disable_vblank)(struct drm_crtc *crtc); 20 void (*disable_vblank)(struct drm_crtc *crtc);
21 int (*set_interface_pix_fmt)(struct drm_crtc *crtc, 21 int (*set_interface_pix_fmt)(struct drm_crtc *crtc,
22 u32 bus_format, int hsync_pin, int vsync_pin); 22 u32 bus_format, int hsync_pin, int vsync_pin,
23 u32 bus_flags);
23 const struct drm_crtc_helper_funcs *crtc_helper_funcs; 24 const struct drm_crtc_helper_funcs *crtc_helper_funcs;
24 const struct drm_crtc_funcs *crtc_funcs; 25 const struct drm_crtc_funcs *crtc_funcs;
25}; 26};
@@ -41,8 +42,8 @@ void imx_drm_mode_config_init(struct drm_device *drm);
41 42
42struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb); 43struct drm_gem_cma_object *imx_drm_fb_get_obj(struct drm_framebuffer *fb);
43 44
44int imx_drm_set_bus_format_pins(struct drm_encoder *encoder, 45int imx_drm_set_bus_config(struct drm_encoder *encoder, u32 bus_format,
45 u32 bus_format, int hsync_pin, int vsync_pin); 46 int hsync_pin, int vsync_pin, u32 bus_flags);
46int imx_drm_set_bus_format(struct drm_encoder *encoder, 47int imx_drm_set_bus_format(struct drm_encoder *encoder,
47 u32 bus_format); 48 u32 bus_format);
48 49
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index a58eee59550a..beff793bb717 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -25,6 +25,7 @@
25#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> 25#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27#include <linux/of_graph.h> 27#include <linux/of_graph.h>
28#include <video/of_display_timing.h>
28#include <video/of_videomode.h> 29#include <video/of_videomode.h>
29#include <linux/regmap.h> 30#include <linux/regmap.h>
30#include <linux/videodev2.h> 31#include <linux/videodev2.h>
@@ -59,6 +60,7 @@ struct imx_ldb_channel {
59 struct drm_encoder encoder; 60 struct drm_encoder encoder;
60 struct drm_panel *panel; 61 struct drm_panel *panel;
61 struct device_node *child; 62 struct device_node *child;
63 struct i2c_adapter *ddc;
62 int chno; 64 int chno;
63 void *edid; 65 void *edid;
64 int edid_len; 66 int edid_len;
@@ -107,6 +109,9 @@ static int imx_ldb_connector_get_modes(struct drm_connector *connector)
107 return num_modes; 109 return num_modes;
108 } 110 }
109 111
112 if (!imx_ldb_ch->edid && imx_ldb_ch->ddc)
113 imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc);
114
110 if (imx_ldb_ch->edid) { 115 if (imx_ldb_ch->edid) {
111 drm_mode_connector_update_edid_property(connector, 116 drm_mode_connector_update_edid_property(connector,
112 imx_ldb_ch->edid); 117 imx_ldb_ch->edid);
@@ -553,7 +558,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
553 558
554 for_each_child_of_node(np, child) { 559 for_each_child_of_node(np, child) {
555 struct imx_ldb_channel *channel; 560 struct imx_ldb_channel *channel;
556 struct device_node *port; 561 struct device_node *ddc_node;
562 struct device_node *ep;
557 563
558 ret = of_property_read_u32(child, "reg", &i); 564 ret = of_property_read_u32(child, "reg", &i);
559 if (ret || i < 0 || i > 1) 565 if (ret || i < 0 || i > 1)
@@ -576,33 +582,54 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
576 * The output port is port@4 with an external 4-port mux or 582 * The output port is port@4 with an external 4-port mux or
577 * port@2 with the internal 2-port mux. 583 * port@2 with the internal 2-port mux.
578 */ 584 */
579 port = of_graph_get_port_by_id(child, imx_ldb->lvds_mux ? 4 : 2); 585 ep = of_graph_get_endpoint_by_regs(child,
580 if (port) { 586 imx_ldb->lvds_mux ? 4 : 2,
581 struct device_node *endpoint, *remote; 587 -1);
582 588 if (ep) {
583 endpoint = of_get_child_by_name(port, "endpoint"); 589 struct device_node *remote;
584 if (endpoint) { 590
585 remote = of_graph_get_remote_port_parent(endpoint); 591 remote = of_graph_get_remote_port_parent(ep);
586 if (remote) 592 of_node_put(ep);
587 channel->panel = of_drm_find_panel(remote); 593 if (remote)
588 else 594 channel->panel = of_drm_find_panel(remote);
589 return -EPROBE_DEFER; 595 else
590 if (!channel->panel) { 596 return -EPROBE_DEFER;
591 dev_err(dev, "panel not found: %s\n", 597 of_node_put(remote);
592 remote->full_name); 598 if (!channel->panel) {
593 return -EPROBE_DEFER; 599 dev_err(dev, "panel not found: %s\n",
594 } 600 remote->full_name);
601 return -EPROBE_DEFER;
595 } 602 }
596 } 603 }
597 604
598 edidp = of_get_property(child, "edid", &channel->edid_len); 605 ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0);
599 if (edidp) { 606 if (ddc_node) {
600 channel->edid = kmemdup(edidp, channel->edid_len, 607 channel->ddc = of_find_i2c_adapter_by_node(ddc_node);
601 GFP_KERNEL); 608 of_node_put(ddc_node);
602 } else if (!channel->panel) { 609 if (!channel->ddc) {
603 ret = of_get_drm_display_mode(child, &channel->mode, 0); 610 dev_warn(dev, "failed to get ddc i2c adapter\n");
604 if (!ret) 611 return -EPROBE_DEFER;
605 channel->mode_valid = 1; 612 }
613 }
614
615 if (!channel->ddc) {
616 /* if no DDC available, fallback to hardcoded EDID */
617 dev_dbg(dev, "no ddc available\n");
618
619 edidp = of_get_property(child, "edid",
620 &channel->edid_len);
621 if (edidp) {
622 channel->edid = kmemdup(edidp,
623 channel->edid_len,
624 GFP_KERNEL);
625 } else if (!channel->panel) {
626 /* fallback to display-timings node */
627 ret = of_get_drm_display_mode(child,
628 &channel->mode,
629 OF_USE_NATIVE_MODE);
630 if (!ret)
631 channel->mode_valid = 1;
632 }
606 } 633 }
607 634
608 channel->bus_format = of_get_bus_format(dev, child); 635 channel->bus_format = of_get_bus_format(dev, child);
@@ -647,6 +674,7 @@ static void imx_ldb_unbind(struct device *dev, struct device *master,
647 channel->encoder.funcs->destroy(&channel->encoder); 674 channel->encoder.funcs->destroy(&channel->encoder);
648 675
649 kfree(channel->edid); 676 kfree(channel->edid);
677 i2c_put_adapter(channel->ddc);
650 } 678 }
651} 679}
652 680
diff --git a/drivers/gpu/drm/imx/imx-tve.c b/drivers/gpu/drm/imx/imx-tve.c
index ae7a9fb3b8a2..baf788121287 100644
--- a/drivers/gpu/drm/imx/imx-tve.c
+++ b/drivers/gpu/drm/imx/imx-tve.c
@@ -294,8 +294,10 @@ static void imx_tve_encoder_prepare(struct drm_encoder *encoder)
294 294
295 switch (tve->mode) { 295 switch (tve->mode) {
296 case TVE_MODE_VGA: 296 case TVE_MODE_VGA:
297 imx_drm_set_bus_format_pins(encoder, MEDIA_BUS_FMT_GBR888_1X24, 297 imx_drm_set_bus_config(encoder, MEDIA_BUS_FMT_GBR888_1X24,
298 tve->hsync_pin, tve->vsync_pin); 298 tve->hsync_pin, tve->vsync_pin,
299 DRM_BUS_FLAG_DE_HIGH |
300 DRM_BUS_FLAG_PIXDATA_NEGEDGE);
299 break; 301 break;
300 case TVE_MODE_TVOUT: 302 case TVE_MODE_TVOUT:
301 imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_YUV8_1X24); 303 imx_drm_set_bus_format(encoder, MEDIA_BUS_FMT_YUV8_1X24);
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c
index b2c30b8d9816..fc040417e1e8 100644
--- a/drivers/gpu/drm/imx/ipuv3-crtc.c
+++ b/drivers/gpu/drm/imx/ipuv3-crtc.c
@@ -66,6 +66,7 @@ struct ipu_crtc {
66 struct ipu_flip_work *flip_work; 66 struct ipu_flip_work *flip_work;
67 int irq; 67 int irq;
68 u32 bus_format; 68 u32 bus_format;
69 u32 bus_flags;
69 int di_hsync_pin; 70 int di_hsync_pin;
70 int di_vsync_pin; 71 int di_vsync_pin;
71}; 72};
@@ -271,8 +272,10 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
271 else 272 else
272 sig_cfg.clkflags = 0; 273 sig_cfg.clkflags = 0;
273 274
274 sig_cfg.enable_pol = 1; 275 sig_cfg.enable_pol = !(ipu_crtc->bus_flags & DRM_BUS_FLAG_DE_LOW);
275 sig_cfg.clk_pol = 0; 276 /* Default to driving pixel data on negative clock edges */
277 sig_cfg.clk_pol = !!(ipu_crtc->bus_flags &
278 DRM_BUS_FLAG_PIXDATA_POSEDGE);
276 sig_cfg.bus_format = ipu_crtc->bus_format; 279 sig_cfg.bus_format = ipu_crtc->bus_format;
277 sig_cfg.v_to_h_sync = 0; 280 sig_cfg.v_to_h_sync = 0;
278 sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin; 281 sig_cfg.hsync_pin = ipu_crtc->di_hsync_pin;
@@ -396,11 +399,12 @@ static void ipu_disable_vblank(struct drm_crtc *crtc)
396} 399}
397 400
398static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc, 401static int ipu_set_interface_pix_fmt(struct drm_crtc *crtc,
399 u32 bus_format, int hsync_pin, int vsync_pin) 402 u32 bus_format, int hsync_pin, int vsync_pin, u32 bus_flags)
400{ 403{
401 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc); 404 struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
402 405
403 ipu_crtc->bus_format = bus_format; 406 ipu_crtc->bus_format = bus_format;
407 ipu_crtc->bus_flags = bus_flags;
404 ipu_crtc->di_hsync_pin = hsync_pin; 408 ipu_crtc->di_hsync_pin = hsync_pin;
405 ipu_crtc->di_vsync_pin = vsync_pin; 409 ipu_crtc->di_vsync_pin = vsync_pin;
406 410
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index 681ec6eb77d9..a4bb44118d33 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -38,6 +38,8 @@ static const uint32_t ipu_plane_formats[] = {
38 DRM_FORMAT_RGBX8888, 38 DRM_FORMAT_RGBX8888,
39 DRM_FORMAT_BGRA8888, 39 DRM_FORMAT_BGRA8888,
40 DRM_FORMAT_BGRA8888, 40 DRM_FORMAT_BGRA8888,
41 DRM_FORMAT_UYVY,
42 DRM_FORMAT_VYUY,
41 DRM_FORMAT_YUYV, 43 DRM_FORMAT_YUYV,
42 DRM_FORMAT_YVYU, 44 DRM_FORMAT_YVYU,
43 DRM_FORMAT_YUV420, 45 DRM_FORMAT_YUV420,
@@ -428,7 +430,6 @@ static int ipu_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
428 if (crtc != plane->crtc) 430 if (crtc != plane->crtc)
429 dev_dbg(plane->dev->dev, "crtc change: %p -> %p\n", 431 dev_dbg(plane->dev->dev, "crtc change: %p -> %p\n",
430 plane->crtc, crtc); 432 plane->crtc, crtc);
431 plane->crtc = crtc;
432 433
433 if (!ipu_plane->enabled) 434 if (!ipu_plane->enabled)
434 ipu_plane_enable(ipu_plane); 435 ipu_plane_enable(ipu_plane);
@@ -461,7 +462,7 @@ static void ipu_plane_destroy(struct drm_plane *plane)
461 kfree(ipu_plane); 462 kfree(ipu_plane);
462} 463}
463 464
464static struct drm_plane_funcs ipu_plane_funcs = { 465static const struct drm_plane_funcs ipu_plane_funcs = {
465 .update_plane = ipu_update_plane, 466 .update_plane = ipu_update_plane,
466 .disable_plane = ipu_disable_plane, 467 .disable_plane = ipu_disable_plane,
467 .destroy = ipu_plane_destroy, 468 .destroy = ipu_plane_destroy,
diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/parallel-display.c
index 363e2c7741e2..2d1fd02cd3d6 100644
--- a/drivers/gpu/drm/imx/parallel-display.c
+++ b/drivers/gpu/drm/imx/parallel-display.c
@@ -35,7 +35,6 @@ struct imx_parallel_display {
35 void *edid; 35 void *edid;
36 int edid_len; 36 int edid_len;
37 u32 bus_format; 37 u32 bus_format;
38 int mode_valid;
39 struct drm_display_mode mode; 38 struct drm_display_mode mode;
40 struct drm_panel *panel; 39 struct drm_panel *panel;
41}; 40};
@@ -68,17 +67,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
68 num_modes = drm_add_edid_modes(connector, imxpd->edid); 67 num_modes = drm_add_edid_modes(connector, imxpd->edid);
69 } 68 }
70 69
71 if (imxpd->mode_valid) {
72 struct drm_display_mode *mode = drm_mode_create(connector->dev);
73
74 if (!mode)
75 return -EINVAL;
76 drm_mode_copy(mode, &imxpd->mode);
77 mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
78 drm_mode_probed_add(connector, mode);
79 num_modes++;
80 }
81
82 if (np) { 70 if (np) {
83 struct drm_display_mode *mode = drm_mode_create(connector->dev); 71 struct drm_display_mode *mode = drm_mode_create(connector->dev);
84 72
@@ -115,8 +103,8 @@ static void imx_pd_encoder_dpms(struct drm_encoder *encoder, int mode)
115static void imx_pd_encoder_prepare(struct drm_encoder *encoder) 103static void imx_pd_encoder_prepare(struct drm_encoder *encoder)
116{ 104{
117 struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); 105 struct imx_parallel_display *imxpd = enc_to_imxpd(encoder);
118 106 imx_drm_set_bus_config(encoder, imxpd->bus_format, 2, 3,
119 imx_drm_set_bus_format(encoder, imxpd->bus_format); 107 imxpd->connector.display_info.bus_flags);
120} 108}
121 109
122static void imx_pd_encoder_commit(struct drm_encoder *encoder) 110static void imx_pd_encoder_commit(struct drm_encoder *encoder)
@@ -203,7 +191,7 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
203{ 191{
204 struct drm_device *drm = data; 192 struct drm_device *drm = data;
205 struct device_node *np = dev->of_node; 193 struct device_node *np = dev->of_node;
206 struct device_node *port; 194 struct device_node *ep;
207 const u8 *edidp; 195 const u8 *edidp;
208 struct imx_parallel_display *imxpd; 196 struct imx_parallel_display *imxpd;
209 int ret; 197 int ret;
@@ -230,18 +218,18 @@ static int imx_pd_bind(struct device *dev, struct device *master, void *data)
230 } 218 }
231 219
232 /* port@1 is the output port */ 220 /* port@1 is the output port */
233 port = of_graph_get_port_by_id(np, 1); 221 ep = of_graph_get_endpoint_by_regs(np, 1, -1);
234 if (port) { 222 if (ep) {
235 struct device_node *endpoint, *remote; 223 struct device_node *remote;
236 224
237 endpoint = of_get_child_by_name(port, "endpoint"); 225 remote = of_graph_get_remote_port_parent(ep);
238 if (endpoint) { 226 of_node_put(ep);
239 remote = of_graph_get_remote_port_parent(endpoint); 227 if (remote) {
240 if (remote) 228 imxpd->panel = of_drm_find_panel(remote);
241 imxpd->panel = of_drm_find_panel(remote); 229 of_node_put(remote);
242 if (!imxpd->panel)
243 return -EPROBE_DEFER;
244 } 230 }
231 if (!imxpd->panel)
232 return -EPROBE_DEFER;
245 } 233 }
246 234
247 imxpd->dev = dev; 235 imxpd->dev = dev;
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index d05ca7901315..0186e500d2a5 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -432,11 +432,6 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
432 unsigned long pll_rate; 432 unsigned long pll_rate;
433 unsigned int factor; 433 unsigned int factor;
434 434
435 if (!dpi) {
436 dev_err(dpi->dev, "invalid argument\n");
437 return -EINVAL;
438 }
439
440 pix_rate = 1000UL * mode->clock; 435 pix_rate = 1000UL * mode->clock;
441 if (mode->clock <= 74000) 436 if (mode->clock <= 74000)
442 factor = 8 * 3; 437 factor = 8 * 3;
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 2d808e59fefd..769559124562 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -695,10 +695,8 @@ static void mtk_dsi_destroy_conn_enc(struct mtk_dsi *dsi)
695{ 695{
696 drm_encoder_cleanup(&dsi->encoder); 696 drm_encoder_cleanup(&dsi->encoder);
697 /* Skip connector cleanup if creation was delegated to the bridge */ 697 /* Skip connector cleanup if creation was delegated to the bridge */
698 if (dsi->conn.dev) { 698 if (dsi->conn.dev)
699 drm_connector_unregister(&dsi->conn);
700 drm_connector_cleanup(&dsi->conn); 699 drm_connector_cleanup(&dsi->conn);
701 }
702} 700}
703 701
704static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp) 702static void mtk_dsi_ddp_start(struct mtk_ddp_comp *comp)
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index ebb470ff7200..2b4b125eebc3 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -101,7 +101,7 @@ static struct drm_driver driver = {
101 .minor = DRIVER_MINOR, 101 .minor = DRIVER_MINOR,
102 .patchlevel = DRIVER_PATCHLEVEL, 102 .patchlevel = DRIVER_PATCHLEVEL,
103 103
104 .gem_free_object = mgag200_gem_free_object, 104 .gem_free_object_unlocked = mgag200_gem_free_object,
105 .dumb_create = mgag200_dumb_create, 105 .dumb_create = mgag200_dumb_create,
106 .dumb_map_offset = mgag200_dumb_mmap_offset, 106 .dumb_map_offset = mgag200_dumb_mmap_offset,
107 .dumb_destroy = drm_gem_dumb_destroy, 107 .dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index f6d5892d03f1..6b21cb27e1cc 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -182,7 +182,7 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
182 } 182 }
183 } 183 }
184 184
185 fvv = pllreffreq * testn / testm; 185 fvv = pllreffreq * (n + 1) / (m + 1);
186 fvv = (fvv - 800000) / 50000; 186 fvv = (fvv - 800000) / 50000;
187 187
188 if (fvv > 15) 188 if (fvv > 15)
@@ -202,6 +202,14 @@ static int mga_g200se_set_plls(struct mga_device *mdev, long clock)
202 WREG_DAC(MGA1064_PIX_PLLC_M, m); 202 WREG_DAC(MGA1064_PIX_PLLC_M, m);
203 WREG_DAC(MGA1064_PIX_PLLC_N, n); 203 WREG_DAC(MGA1064_PIX_PLLC_N, n);
204 WREG_DAC(MGA1064_PIX_PLLC_P, p); 204 WREG_DAC(MGA1064_PIX_PLLC_P, p);
205
206 if (mdev->unique_rev_id >= 0x04) {
207 WREG_DAC(0x1a, 0x09);
208 msleep(20);
209 WREG_DAC(0x1a, 0x01);
210
211 }
212
205 return 0; 213 return 0;
206} 214}
207 215
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 461dc8b873f0..7919c24c6ddd 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -56,17 +56,9 @@ static void msm_framebuffer_destroy(struct drm_framebuffer *fb)
56 kfree(msm_fb); 56 kfree(msm_fb);
57} 57}
58 58
59static int msm_framebuffer_dirty(struct drm_framebuffer *fb,
60 struct drm_file *file_priv, unsigned flags, unsigned color,
61 struct drm_clip_rect *clips, unsigned num_clips)
62{
63 return 0;
64}
65
66static const struct drm_framebuffer_funcs msm_framebuffer_funcs = { 59static const struct drm_framebuffer_funcs msm_framebuffer_funcs = {
67 .create_handle = msm_framebuffer_create_handle, 60 .create_handle = msm_framebuffer_create_handle,
68 .destroy = msm_framebuffer_destroy, 61 .destroy = msm_framebuffer_destroy,
69 .dirty = msm_framebuffer_dirty,
70}; 62};
71 63
72#ifdef CONFIG_DEBUG_FS 64#ifdef CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 5c4d4dff2da8..c00ff6e786a3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -962,7 +962,7 @@ driver_stub = {
962 .gem_prime_vmap = nouveau_gem_prime_vmap, 962 .gem_prime_vmap = nouveau_gem_prime_vmap,
963 .gem_prime_vunmap = nouveau_gem_prime_vunmap, 963 .gem_prime_vunmap = nouveau_gem_prime_vunmap,
964 964
965 .gem_free_object = nouveau_gem_object_del, 965 .gem_free_object_unlocked = nouveau_gem_object_del,
966 .gem_open_object = nouveau_gem_object_open, 966 .gem_open_object = nouveau_gem_object_open,
967 .gem_close_object = nouveau_gem_object_close, 967 .gem_close_object = nouveau_gem_object_close,
968 968
diff --git a/drivers/gpu/drm/omapdrm/Kconfig b/drivers/gpu/drm/omapdrm/Kconfig
index 73241c4eb7aa..336ad4de9981 100644
--- a/drivers/gpu/drm/omapdrm/Kconfig
+++ b/drivers/gpu/drm/omapdrm/Kconfig
@@ -2,6 +2,7 @@ config DRM_OMAP
2 tristate "OMAP DRM" 2 tristate "OMAP DRM"
3 depends on DRM 3 depends on DRM
4 depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM 4 depends on ARCH_OMAP2PLUS || ARCH_MULTIPLATFORM
5 select OMAP2_DSS
5 select DRM_KMS_HELPER 6 select DRM_KMS_HELPER
6 select DRM_KMS_FB_HELPER 7 select DRM_KMS_FB_HELPER
7 select FB_SYS_FILLRECT 8 select FB_SYS_FILLRECT
diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
index 225fd8d6ab31..667ca4a24ece 100644
--- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
+++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio/consumer.h>
12#include <linux/slab.h> 13#include <linux/slab.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
index 8c246c213e06..9594ff7a2b0c 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
@@ -14,7 +14,7 @@
14 * the Free Software Foundation. 14 * the Free Software Foundation.
15 */ 15 */
16 16
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
index 2fd5602880a7..671806ca7d6a 100644
--- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
+++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
@@ -9,7 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio.h> 12#include <linux/gpio/consumer.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
index e780fd4f8b46..7c2331be8d15 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c
@@ -9,7 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/gpio.h> 12#include <linux/gpio/consumer.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
index 36485c2137ce..2b118071b5a1 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
@@ -14,7 +14,7 @@
14#include <linux/backlight.h> 14#include <linux/backlight.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/jiffies.h> 19#include <linux/jiffies.h>
20#include <linux/module.h> 20#include <linux/module.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
index 458f77bc473d..ac680e1de603 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
@@ -15,6 +15,7 @@
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/gpio/consumer.h>
18 19
19#include <video/omapdss.h> 20#include <video/omapdss.h>
20#include <video/omap-panel-data.h> 21#include <video/omap-panel-data.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
index 780cb263a318..38d2920a95e6 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
@@ -15,7 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/spi/spi.h> 16#include <linux/spi/spi.h>
17#include <linux/fb.h> 17#include <linux/fb.h>
18#include <linux/gpio.h> 18#include <linux/gpio/consumer.h>
19#include <linux/of_gpio.h> 19#include <linux/of_gpio.h>
20 20
21#include <video/omapdss.h> 21#include <video/omapdss.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
index 529a017602e4..4363fffc87e3 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/delay.h> 12#include <linux/delay.h>
13#include <linux/gpio.h> 13#include <linux/gpio/consumer.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_gpio.h> 16#include <linux/of_gpio.h>
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
index 31efcca801bd..deb416736aad 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
@@ -29,7 +29,7 @@
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/backlight.h> 30#include <linux/backlight.h>
31#include <linux/fb.h> 31#include <linux/fb.h>
32#include <linux/gpio.h> 32#include <linux/gpio/consumer.h>
33#include <linux/of.h> 33#include <linux/of.h>
34#include <linux/of_gpio.h> 34#include <linux/of_gpio.h>
35 35
diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
index 03e2beb7b4f0..d93175b03a12 100644
--- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
+++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
@@ -14,7 +14,7 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/regulator/consumer.h> 16#include <linux/regulator/consumer.h>
17#include <linux/gpio.h> 17#include <linux/gpio/consumer.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/of_gpio.h> 20#include <linux/of_gpio.h>
diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index 8730646a0cbb..9ed8272e54ae 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -1180,15 +1180,6 @@ static int dsi_regulator_init(struct platform_device *dsidev)
1180 return PTR_ERR(vdds_dsi); 1180 return PTR_ERR(vdds_dsi);
1181 } 1181 }
1182 1182
1183 if (regulator_can_change_voltage(vdds_dsi)) {
1184 r = regulator_set_voltage(vdds_dsi, 1800000, 1800000);
1185 if (r) {
1186 devm_regulator_put(vdds_dsi);
1187 DSSERR("can't set the DSI regulator voltage\n");
1188 return r;
1189 }
1190 }
1191
1192 dsi->vdds_dsi_reg = vdds_dsi; 1183 dsi->vdds_dsi_reg = vdds_dsi;
1193 1184
1194 return 0; 1185 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index f95ff319e68e..3303cfad4838 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -30,6 +30,7 @@
30#include <linux/delay.h> 30#include <linux/delay.h>
31#include <linux/seq_file.h> 31#include <linux/seq_file.h>
32#include <linux/clk.h> 32#include <linux/clk.h>
33#include <linux/pinctrl/consumer.h>
33#include <linux/platform_device.h> 34#include <linux/platform_device.h>
34#include <linux/pm_runtime.h> 35#include <linux/pm_runtime.h>
35#include <linux/gfp.h> 36#include <linux/gfp.h>
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index f892ae157ff3..4d46cdf7a037 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -33,6 +33,7 @@
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/regulator/consumer.h> 34#include <linux/regulator/consumer.h>
35#include <linux/component.h> 35#include <linux/component.h>
36#include <linux/of.h>
36#include <video/omapdss.h> 37#include <video/omapdss.h>
37#include <sound/omap-hdmi-audio.h> 38#include <sound/omap-hdmi-audio.h>
38 39
@@ -100,7 +101,6 @@ static irqreturn_t hdmi_irq_handler(int irq, void *data)
100 101
101static int hdmi_init_regulator(void) 102static int hdmi_init_regulator(void)
102{ 103{
103 int r;
104 struct regulator *reg; 104 struct regulator *reg;
105 105
106 if (hdmi.vdda_reg != NULL) 106 if (hdmi.vdda_reg != NULL)
@@ -114,15 +114,6 @@ static int hdmi_init_regulator(void)
114 return PTR_ERR(reg); 114 return PTR_ERR(reg);
115 } 115 }
116 116
117 if (regulator_can_change_voltage(reg)) {
118 r = regulator_set_voltage(reg, 1800000, 1800000);
119 if (r) {
120 devm_regulator_put(reg);
121 DSSWARN("can't set the regulator voltage\n");
122 return r;
123 }
124 }
125
126 hdmi.vdda_reg = reg; 117 hdmi.vdda_reg = reg;
127 118
128 return 0; 119 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
index fa72e735dad2..ef3afe99e487 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c
@@ -211,7 +211,7 @@ static void hdmi_core_init(struct hdmi_core_video_config *video_cfg)
211static void hdmi_core_powerdown_disable(struct hdmi_core_data *core) 211static void hdmi_core_powerdown_disable(struct hdmi_core_data *core)
212{ 212{
213 DSSDBG("Enter hdmi_core_powerdown_disable\n"); 213 DSSDBG("Enter hdmi_core_powerdown_disable\n");
214 REG_FLD_MOD(core->base, HDMI_CORE_SYS_SYS_CTRL1, 0x0, 0, 0); 214 REG_FLD_MOD(core->base, HDMI_CORE_SYS_SYS_CTRL1, 0x1, 0, 0);
215} 215}
216 216
217static void hdmi_core_swreset_release(struct hdmi_core_data *core) 217static void hdmi_core_swreset_release(struct hdmi_core_data *core)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index a43f7b10e113..e129245eb8a9 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -38,6 +38,7 @@
38#include <linux/gpio.h> 38#include <linux/gpio.h>
39#include <linux/regulator/consumer.h> 39#include <linux/regulator/consumer.h>
40#include <linux/component.h> 40#include <linux/component.h>
41#include <linux/of.h>
41#include <video/omapdss.h> 42#include <video/omapdss.h>
42#include <sound/omap-hdmi-audio.h> 43#include <sound/omap-hdmi-audio.h>
43 44
@@ -131,15 +132,6 @@ static int hdmi_init_regulator(void)
131 return PTR_ERR(reg); 132 return PTR_ERR(reg);
132 } 133 }
133 134
134 if (regulator_can_change_voltage(reg)) {
135 r = regulator_set_voltage(reg, 1800000, 1800000);
136 if (r) {
137 devm_regulator_put(reg);
138 DSSWARN("can't set the regulator voltage\n");
139 return r;
140 }
141 }
142
143 hdmi.vdda_reg = reg; 135 hdmi.vdda_reg = reg;
144 136
145 return 0; 137 return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
index 6a397520cae5..8ab2093daa12 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5_core.c
@@ -51,8 +51,8 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core)
51{ 51{
52 void __iomem *base = core->base; 52 void __iomem *base = core->base;
53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */ 53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */
54 const unsigned ss_scl_high = 4000; /* ns */ 54 const unsigned ss_scl_high = 4600; /* ns */
55 const unsigned ss_scl_low = 4700; /* ns */ 55 const unsigned ss_scl_low = 5400; /* ns */
56 const unsigned fs_scl_high = 600; /* ns */ 56 const unsigned fs_scl_high = 600; /* ns */
57 const unsigned fs_scl_low = 1300; /* ns */ 57 const unsigned fs_scl_low = 1300; /* ns */
58 const unsigned sda_hold = 1000; /* ns */ 58 const unsigned sda_hold = 1000; /* ns */
@@ -458,7 +458,7 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
458 458
459 c = (ptr[1] >> 6) & 0x3; 459 c = (ptr[1] >> 6) & 0x3;
460 m = (ptr[1] >> 4) & 0x3; 460 m = (ptr[1] >> 4) & 0x3;
461 r = (ptr[1] >> 0) & 0x3; 461 r = (ptr[1] >> 0) & 0xf;
462 462
463 itc = (ptr[2] >> 7) & 0x1; 463 itc = (ptr[2] >> 7) & 0x1;
464 ec = (ptr[2] >> 4) & 0x7; 464 ec = (ptr[2] >> 4) & 0x7;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
index 1f5d19c119ce..f98b750fc499 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_phy.c
@@ -13,6 +13,7 @@
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/seq_file.h>
16#include <video/omapdss.h> 17#include <video/omapdss.h>
17 18
18#include "dss.h" 19#include "dss.h"
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 06e23a7c432c..f1015e8b8267 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/seq_file.h>
19 20
20#include <video/omapdss.h> 21#include <video/omapdss.h>
21 22
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
index 13442b9052d1..055f62fca5dc 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c
@@ -14,6 +14,7 @@
14#include <linux/err.h> 14#include <linux/err.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/seq_file.h>
17#include <video/omapdss.h> 18#include <video/omapdss.h>
18 19
19#include "dss.h" 20#include "dss.h"
diff --git a/drivers/gpu/drm/omapdrm/omap_debugfs.c b/drivers/gpu/drm/omapdrm/omap_debugfs.c
index 6f5fc14fc015..479bf24050f8 100644
--- a/drivers/gpu/drm/omapdrm/omap_debugfs.c
+++ b/drivers/gpu/drm/omapdrm/omap_debugfs.c
@@ -17,6 +17,8 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
21
20#include <drm/drm_crtc.h> 22#include <drm/drm_crtc.h>
21#include <drm/drm_fb_helper.h> 23#include <drm/drm_fb_helper.h>
22 24
diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
index de275a5be1db..4ceed7a9762f 100644
--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
+++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
@@ -27,6 +27,7 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/platform_device.h> /* platform_device() */ 28#include <linux/platform_device.h> /* platform_device() */
29#include <linux/sched.h> 29#include <linux/sched.h>
30#include <linux/seq_file.h>
30#include <linux/slab.h> 31#include <linux/slab.h>
31#include <linux/time.h> 32#include <linux/time.h>
32#include <linux/vmalloc.h> 33#include <linux/vmalloc.h>
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 94ec06d3d737..664ccf97bc11 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -17,6 +17,8 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
21
20#include <drm/drm_crtc.h> 22#include <drm/drm_crtc.h>
21#include <drm/drm_crtc_helper.h> 23#include <drm/drm_crtc_helper.h>
22 24
@@ -120,17 +122,9 @@ static void omap_framebuffer_destroy(struct drm_framebuffer *fb)
120 kfree(omap_fb); 122 kfree(omap_fb);
121} 123}
122 124
123static int omap_framebuffer_dirty(struct drm_framebuffer *fb,
124 struct drm_file *file_priv, unsigned flags, unsigned color,
125 struct drm_clip_rect *clips, unsigned num_clips)
126{
127 return 0;
128}
129
130static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { 125static const struct drm_framebuffer_funcs omap_framebuffer_funcs = {
131 .create_handle = omap_framebuffer_create_handle, 126 .create_handle = omap_framebuffer_create_handle,
132 .destroy = omap_framebuffer_destroy, 127 .destroy = omap_framebuffer_destroy,
133 .dirty = omap_framebuffer_dirty,
134}; 128};
135 129
136static uint32_t get_linear_addr(struct plane *plane, 130static uint32_t get_linear_addr(struct plane *plane,
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index b97afc281778..03698b6c806c 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -17,6 +17,7 @@
17 * this program. If not, see <http://www.gnu.org/licenses/>. 17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */ 18 */
19 19
20#include <linux/seq_file.h>
20#include <linux/shmem_fs.h> 21#include <linux/shmem_fs.h>
21#include <linux/spinlock.h> 22#include <linux/spinlock.h>
22#include <linux/pfn_t.h> 23#include <linux/pfn_t.h>
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index dc9df5fe50ba..460bbceae297 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -256,7 +256,7 @@ static struct drm_driver qxl_driver = {
256 .gem_prime_vmap = qxl_gem_prime_vmap, 256 .gem_prime_vmap = qxl_gem_prime_vmap,
257 .gem_prime_vunmap = qxl_gem_prime_vunmap, 257 .gem_prime_vunmap = qxl_gem_prime_vunmap,
258 .gem_prime_mmap = qxl_gem_prime_mmap, 258 .gem_prime_mmap = qxl_gem_prime_mmap,
259 .gem_free_object = qxl_gem_object_free, 259 .gem_free_object_unlocked = qxl_gem_object_free,
260 .gem_open_object = qxl_gem_object_open, 260 .gem_open_object = qxl_gem_object_open,
261 .gem_close_object = qxl_gem_object_close, 261 .gem_close_object = qxl_gem_object_close,
262 .fops = &qxl_fops, 262 .fops = &qxl_fops,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index fb9242d27883..48ec4b6e8b26 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -217,7 +217,7 @@ static struct drm_driver rcar_du_driver = {
217 .get_vblank_counter = drm_vblank_no_hw_counter, 217 .get_vblank_counter = drm_vblank_no_hw_counter,
218 .enable_vblank = rcar_du_enable_vblank, 218 .enable_vblank = rcar_du_enable_vblank,
219 .disable_vblank = rcar_du_disable_vblank, 219 .disable_vblank = rcar_du_disable_vblank,
220 .gem_free_object = drm_gem_cma_free_object, 220 .gem_free_object_unlocked = drm_gem_cma_free_object,
221 .gem_vm_ops = &drm_gem_cma_vm_ops, 221 .gem_vm_ops = &drm_gem_cma_vm_ops,
222 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 222 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
223 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 223 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index a409d1f703cb..09a4d429c0f0 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -19,6 +19,7 @@
19#include <drm/drmP.h> 19#include <drm/drmP.h>
20#include <drm/drm_crtc_helper.h> 20#include <drm/drm_crtc_helper.h>
21#include <drm/drm_fb_helper.h> 21#include <drm/drm_fb_helper.h>
22#include <drm/drm_gem_cma_helper.h>
22#include <linux/dma-mapping.h> 23#include <linux/dma-mapping.h>
23#include <linux/pm_runtime.h> 24#include <linux/pm_runtime.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -300,11 +301,6 @@ static const struct file_operations rockchip_drm_driver_fops = {
300 .release = drm_release, 301 .release = drm_release,
301}; 302};
302 303
303const struct vm_operations_struct rockchip_drm_vm_ops = {
304 .open = drm_gem_vm_open,
305 .close = drm_gem_vm_close,
306};
307
308static struct drm_driver rockchip_drm_driver = { 304static struct drm_driver rockchip_drm_driver = {
309 .driver_features = DRIVER_MODESET | DRIVER_GEM | 305 .driver_features = DRIVER_MODESET | DRIVER_GEM |
310 DRIVER_PRIME | DRIVER_ATOMIC, 306 DRIVER_PRIME | DRIVER_ATOMIC,
@@ -315,8 +311,8 @@ static struct drm_driver rockchip_drm_driver = {
315 .get_vblank_counter = drm_vblank_no_hw_counter, 311 .get_vblank_counter = drm_vblank_no_hw_counter,
316 .enable_vblank = rockchip_drm_crtc_enable_vblank, 312 .enable_vblank = rockchip_drm_crtc_enable_vblank,
317 .disable_vblank = rockchip_drm_crtc_disable_vblank, 313 .disable_vblank = rockchip_drm_crtc_disable_vblank,
318 .gem_vm_ops = &rockchip_drm_vm_ops, 314 .gem_vm_ops = &drm_gem_cma_vm_ops,
319 .gem_free_object = rockchip_gem_free_object, 315 .gem_free_object_unlocked = rockchip_gem_free_object,
320 .dumb_create = rockchip_gem_dumb_create, 316 .dumb_create = rockchip_gem_dumb_create,
321 .dumb_map_offset = rockchip_gem_dumb_map_offset, 317 .dumb_map_offset = rockchip_gem_dumb_map_offset,
322 .dumb_destroy = drm_gem_dumb_destroy, 318 .dumb_destroy = drm_gem_dumb_destroy,
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 7700ff172079..ee79264b5b6a 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -264,7 +264,7 @@ static struct drm_driver shmob_drm_driver = {
264 .get_vblank_counter = drm_vblank_no_hw_counter, 264 .get_vblank_counter = drm_vblank_no_hw_counter,
265 .enable_vblank = shmob_drm_enable_vblank, 265 .enable_vblank = shmob_drm_enable_vblank,
266 .disable_vblank = shmob_drm_disable_vblank, 266 .disable_vblank = shmob_drm_disable_vblank,
267 .gem_free_object = drm_gem_cma_free_object, 267 .gem_free_object_unlocked = drm_gem_cma_free_object,
268 .gem_vm_ops = &drm_gem_cma_vm_ops, 268 .gem_vm_ops = &drm_gem_cma_vm_ops,
269 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 269 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
270 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 270 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 505620c7c2c8..e04deedabd4a 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -51,15 +51,6 @@ static void sti_crtc_disabling(struct drm_crtc *crtc)
51 mixer->status = STI_MIXER_DISABLING; 51 mixer->status = STI_MIXER_DISABLING;
52} 52}
53 53
54static bool sti_crtc_mode_fixup(struct drm_crtc *crtc,
55 const struct drm_display_mode *mode,
56 struct drm_display_mode *adjusted_mode)
57{
58 /* accept the provided drm_display_mode, do not fix it up */
59 drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
60 return true;
61}
62
63static int 54static int
64sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode) 55sti_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode)
65{ 56{
@@ -230,7 +221,6 @@ static void sti_crtc_atomic_flush(struct drm_crtc *crtc,
230static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = { 221static const struct drm_crtc_helper_funcs sti_crtc_helper_funcs = {
231 .enable = sti_crtc_enable, 222 .enable = sti_crtc_enable,
232 .disable = sti_crtc_disabling, 223 .disable = sti_crtc_disabling,
233 .mode_fixup = sti_crtc_mode_fixup,
234 .mode_set = drm_helper_crtc_mode_set, 224 .mode_set = drm_helper_crtc_mode_set,
235 .mode_set_nofb = sti_crtc_mode_set_nofb, 225 .mode_set_nofb = sti_crtc_mode_set_nofb,
236 .mode_set_base = drm_helper_crtc_mode_set_base, 226 .mode_set_base = drm_helper_crtc_mode_set_base,
diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c
index 4e990299735c..53aa0029295b 100644
--- a/drivers/gpu/drm/sti/sti_cursor.c
+++ b/drivers/gpu/drm/sti/sti_cursor.c
@@ -105,12 +105,6 @@ static int cursor_dbg_show(struct seq_file *s, void *data)
105{ 105{
106 struct drm_info_node *node = s->private; 106 struct drm_info_node *node = s->private;
107 struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data; 107 struct sti_cursor *cursor = (struct sti_cursor *)node->info_ent->data;
108 struct drm_device *dev = node->minor->dev;
109 int ret;
110
111 ret = mutex_lock_interruptible(&dev->struct_mutex);
112 if (ret)
113 return ret;
114 108
115 seq_printf(s, "%s: (vaddr = 0x%p)", 109 seq_printf(s, "%s: (vaddr = 0x%p)",
116 sti_plane_to_str(&cursor->plane), cursor->regs); 110 sti_plane_to_str(&cursor->plane), cursor->regs);
@@ -129,7 +123,6 @@ static int cursor_dbg_show(struct seq_file *s, void *data)
129 DBGFS_DUMP(CUR_AWE); 123 DBGFS_DUMP(CUR_AWE);
130 seq_puts(s, "\n"); 124 seq_puts(s, "\n");
131 125
132 mutex_unlock(&dev->struct_mutex);
133 return 0; 126 return 0;
134} 127}
135 128
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 872495e72294..b440617a7019 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -72,11 +72,6 @@ static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
72 struct drm_info_node *node = s->private; 72 struct drm_info_node *node = s->private;
73 struct drm_device *dev = node->minor->dev; 73 struct drm_device *dev = node->minor->dev;
74 struct drm_plane *p; 74 struct drm_plane *p;
75 int ret;
76
77 ret = mutex_lock_interruptible(&dev->struct_mutex);
78 if (ret)
79 return ret;
80 75
81 list_for_each_entry(p, &dev->mode_config.plane_list, head) { 76 list_for_each_entry(p, &dev->mode_config.plane_list, head) {
82 struct sti_plane *plane = to_sti_plane(p); 77 struct sti_plane *plane = to_sti_plane(p);
@@ -86,7 +81,6 @@ static int sti_drm_fps_dbg_show(struct seq_file *s, void *data)
86 plane->fps_info.fips_str); 81 plane->fps_info.fips_str);
87 } 82 }
88 83
89 mutex_unlock(&dev->struct_mutex);
90 return 0; 84 return 0;
91} 85}
92 86
@@ -310,7 +304,7 @@ static struct drm_driver sti_driver = {
310 .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET | 304 .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET |
311 DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, 305 DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC,
312 .load = sti_load, 306 .load = sti_load,
313 .gem_free_object = drm_gem_cma_free_object, 307 .gem_free_object_unlocked = drm_gem_cma_free_object,
314 .gem_vm_ops = &drm_gem_cma_vm_ops, 308 .gem_vm_ops = &drm_gem_cma_vm_ops,
315 .dumb_create = drm_gem_cma_dumb_create, 309 .dumb_create = drm_gem_cma_dumb_create,
316 .dumb_map_offset = drm_gem_cma_dumb_map_offset, 310 .dumb_map_offset = drm_gem_cma_dumb_map_offset,
diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c
index 25f76632002c..d439128e6309 100644
--- a/drivers/gpu/drm/sti/sti_dvo.c
+++ b/drivers/gpu/drm/sti/sti_dvo.c
@@ -177,12 +177,6 @@ static int dvo_dbg_show(struct seq_file *s, void *data)
177{ 177{
178 struct drm_info_node *node = s->private; 178 struct drm_info_node *node = s->private;
179 struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data; 179 struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data;
180 struct drm_device *dev = node->minor->dev;
181 int ret;
182
183 ret = mutex_lock_interruptible(&dev->struct_mutex);
184 if (ret)
185 return ret;
186 180
187 seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs); 181 seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs);
188 DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL); 182 DBGFS_DUMP(DVO_AWG_DIGSYNC_CTRL);
@@ -193,7 +187,6 @@ static int dvo_dbg_show(struct seq_file *s, void *data)
193 dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I); 187 dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I);
194 seq_puts(s, "\n"); 188 seq_puts(s, "\n");
195 189
196 mutex_unlock(&dev->struct_mutex);
197 return 0; 190 return 0;
198} 191}
199 192
diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index ff33c38da197..fdf69b5a041b 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -208,14 +208,8 @@ static int gdp_dbg_show(struct seq_file *s, void *data)
208{ 208{
209 struct drm_info_node *node = s->private; 209 struct drm_info_node *node = s->private;
210 struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data; 210 struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
211 struct drm_device *dev = node->minor->dev;
212 struct drm_plane *drm_plane = &gdp->plane.drm_plane; 211 struct drm_plane *drm_plane = &gdp->plane.drm_plane;
213 struct drm_crtc *crtc = drm_plane->crtc; 212 struct drm_crtc *crtc = drm_plane->crtc;
214 int ret;
215
216 ret = mutex_lock_interruptible(&dev->struct_mutex);
217 if (ret)
218 return ret;
219 213
220 seq_printf(s, "%s: (vaddr = 0x%p)", 214 seq_printf(s, "%s: (vaddr = 0x%p)",
221 sti_plane_to_str(&gdp->plane), gdp->regs); 215 sti_plane_to_str(&gdp->plane), gdp->regs);
@@ -248,7 +242,6 @@ static int gdp_dbg_show(struct seq_file *s, void *data)
248 seq_printf(s, " Connected to DRM CRTC #%d (%s)\n", 242 seq_printf(s, " Connected to DRM CRTC #%d (%s)\n",
249 crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc))); 243 crtc->base.id, sti_mixer_to_str(to_sti_mixer(crtc)));
250 244
251 mutex_unlock(&dev->struct_mutex);
252 return 0; 245 return 0;
253} 246}
254 247
@@ -279,13 +272,7 @@ static int gdp_node_dbg_show(struct seq_file *s, void *arg)
279{ 272{
280 struct drm_info_node *node = s->private; 273 struct drm_info_node *node = s->private;
281 struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data; 274 struct sti_gdp *gdp = (struct sti_gdp *)node->info_ent->data;
282 struct drm_device *dev = node->minor->dev;
283 unsigned int b; 275 unsigned int b;
284 int ret;
285
286 ret = mutex_lock_interruptible(&dev->struct_mutex);
287 if (ret)
288 return ret;
289 276
290 for (b = 0; b < GDP_NODE_NB_BANK; b++) { 277 for (b = 0; b < GDP_NODE_NB_BANK; b++) {
291 seq_printf(s, "\n%s[%d].top", sti_plane_to_str(&gdp->plane), b); 278 seq_printf(s, "\n%s[%d].top", sti_plane_to_str(&gdp->plane), b);
@@ -294,7 +281,6 @@ static int gdp_node_dbg_show(struct seq_file *s, void *arg)
294 gdp_node_dump_node(s, gdp->node_list[b].btm_field); 281 gdp_node_dump_node(s, gdp->node_list[b].btm_field);
295 } 282 }
296 283
297 mutex_unlock(&dev->struct_mutex);
298 return 0; 284 return 0;
299} 285}
300 286
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index f7d3464cdf09..9f49c00f1a02 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -376,12 +376,6 @@ static int hda_dbg_show(struct seq_file *s, void *data)
376{ 376{
377 struct drm_info_node *node = s->private; 377 struct drm_info_node *node = s->private;
378 struct sti_hda *hda = (struct sti_hda *)node->info_ent->data; 378 struct sti_hda *hda = (struct sti_hda *)node->info_ent->data;
379 struct drm_device *dev = node->minor->dev;
380 int ret;
381
382 ret = mutex_lock_interruptible(&dev->struct_mutex);
383 if (ret)
384 return ret;
385 379
386 seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs); 380 seq_printf(s, "HD Analog: (vaddr = 0x%p)", hda->regs);
387 DBGFS_DUMP(HDA_ANA_CFG); 381 DBGFS_DUMP(HDA_ANA_CFG);
@@ -397,7 +391,6 @@ static int hda_dbg_show(struct seq_file *s, void *data)
397 hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl); 391 hda_dbg_video_dacs_ctrl(s, hda->video_dacs_ctrl);
398 seq_puts(s, "\n"); 392 seq_puts(s, "\n");
399 393
400 mutex_unlock(&dev->struct_mutex);
401 return 0; 394 return 0;
402} 395}
403 396
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 6ef0715bd5b9..85545ebf88d3 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -628,12 +628,6 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
628{ 628{
629 struct drm_info_node *node = s->private; 629 struct drm_info_node *node = s->private;
630 struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data; 630 struct sti_hdmi *hdmi = (struct sti_hdmi *)node->info_ent->data;
631 struct drm_device *dev = node->minor->dev;
632 int ret;
633
634 ret = mutex_lock_interruptible(&dev->struct_mutex);
635 if (ret)
636 return ret;
637 631
638 seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs); 632 seq_printf(s, "HDMI: (vaddr = 0x%p)", hdmi->regs);
639 DBGFS_DUMP("\n", HDMI_CFG); 633 DBGFS_DUMP("\n", HDMI_CFG);
@@ -690,7 +684,6 @@ static int hdmi_dbg_show(struct seq_file *s, void *data)
690 DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_VENDOR); 684 DBGFS_DUMP_DI(HDMI_SW_DI_N_PKT_WORD6, HDMI_IFRAME_SLOT_VENDOR);
691 seq_puts(s, "\n"); 685 seq_puts(s, "\n");
692 686
693 mutex_unlock(&dev->struct_mutex);
694 return 0; 687 return 0;
695} 688}
696 689
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 1edec29b9e45..1c06a50fddca 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -555,14 +555,8 @@ static int hqvdp_dbg_show(struct seq_file *s, void *data)
555{ 555{
556 struct drm_info_node *node = s->private; 556 struct drm_info_node *node = s->private;
557 struct sti_hqvdp *hqvdp = (struct sti_hqvdp *)node->info_ent->data; 557 struct sti_hqvdp *hqvdp = (struct sti_hqvdp *)node->info_ent->data;
558 struct drm_device *dev = node->minor->dev;
559 int cmd, cmd_offset, infoxp70; 558 int cmd, cmd_offset, infoxp70;
560 void *virt; 559 void *virt;
561 int ret;
562
563 ret = mutex_lock_interruptible(&dev->struct_mutex);
564 if (ret)
565 return ret;
566 560
567 seq_printf(s, "%s: (vaddr = 0x%p)", 561 seq_printf(s, "%s: (vaddr = 0x%p)",
568 sti_plane_to_str(&hqvdp->plane), hqvdp->regs); 562 sti_plane_to_str(&hqvdp->plane), hqvdp->regs);
@@ -630,7 +624,6 @@ static int hqvdp_dbg_show(struct seq_file *s, void *data)
630 624
631 seq_puts(s, "\n"); 625 seq_puts(s, "\n");
632 626
633 mutex_unlock(&dev->struct_mutex);
634 return 0; 627 return 0;
635} 628}
636 629
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index aed7801b51f7..6f86f2b2b6a5 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -151,12 +151,6 @@ static int mixer_dbg_show(struct seq_file *s, void *arg)
151{ 151{
152 struct drm_info_node *node = s->private; 152 struct drm_info_node *node = s->private;
153 struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data; 153 struct sti_mixer *mixer = (struct sti_mixer *)node->info_ent->data;
154 struct drm_device *dev = node->minor->dev;
155 int ret;
156
157 ret = mutex_lock_interruptible(&dev->struct_mutex);
158 if (ret)
159 return ret;
160 154
161 seq_printf(s, "%s: (vaddr = 0x%p)", 155 seq_printf(s, "%s: (vaddr = 0x%p)",
162 sti_mixer_to_str(mixer), mixer->regs); 156 sti_mixer_to_str(mixer), mixer->regs);
@@ -176,7 +170,6 @@ static int mixer_dbg_show(struct seq_file *s, void *arg)
176 mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0); 170 mixer_dbg_mxn(s, mixer->regs + GAM_MIXER_MX0);
177 seq_puts(s, "\n"); 171 seq_puts(s, "\n");
178 172
179 mutex_unlock(&dev->struct_mutex);
180 return 0; 173 return 0;
181} 174}
182 175
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index f983db5a59da..60fe0afa5644 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -515,13 +515,7 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
515{ 515{
516 struct drm_info_node *node = s->private; 516 struct drm_info_node *node = s->private;
517 struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data; 517 struct sti_tvout *tvout = (struct sti_tvout *)node->info_ent->data;
518 struct drm_device *dev = node->minor->dev;
519 struct drm_crtc *crtc; 518 struct drm_crtc *crtc;
520 int ret;
521
522 ret = mutex_lock_interruptible(&dev->struct_mutex);
523 if (ret)
524 return ret;
525 519
526 seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs); 520 seq_printf(s, "TVOUT: (vaddr = 0x%p)", tvout->regs);
527 521
@@ -587,7 +581,6 @@ static int tvout_dbg_show(struct seq_file *s, void *data)
587 DBGFS_DUMP(TVO_AUX_IN_VID_FORMAT); 581 DBGFS_DUMP(TVO_AUX_IN_VID_FORMAT);
588 seq_puts(s, "\n"); 582 seq_puts(s, "\n");
589 583
590 mutex_unlock(&dev->struct_mutex);
591 return 0; 584 return 0;
592} 585}
593 586
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 523ed19f5ac6..0132aaebe598 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -92,12 +92,6 @@ static int vid_dbg_show(struct seq_file *s, void *arg)
92{ 92{
93 struct drm_info_node *node = s->private; 93 struct drm_info_node *node = s->private;
94 struct sti_vid *vid = (struct sti_vid *)node->info_ent->data; 94 struct sti_vid *vid = (struct sti_vid *)node->info_ent->data;
95 struct drm_device *dev = node->minor->dev;
96 int ret;
97
98 ret = mutex_lock_interruptible(&dev->struct_mutex);
99 if (ret)
100 return ret;
101 95
102 seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs); 96 seq_printf(s, "VID: (vaddr= 0x%p)", vid->regs);
103 97
@@ -122,7 +116,6 @@ static int vid_dbg_show(struct seq_file *s, void *arg)
122 DBGFS_DUMP(VID_CSAT); 116 DBGFS_DUMP(VID_CSAT);
123 seq_puts(s, "\n"); 117 seq_puts(s, "\n");
124 118
125 mutex_unlock(&dev->struct_mutex);
126 return 0; 119 return 0;
127} 120}
128 121
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 76e922bb60e5..68e9d85085fb 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -103,7 +103,7 @@ static struct drm_driver sun4i_drv_driver = {
103 .dumb_create = drm_gem_cma_dumb_create, 103 .dumb_create = drm_gem_cma_dumb_create,
104 .dumb_destroy = drm_gem_dumb_destroy, 104 .dumb_destroy = drm_gem_dumb_destroy,
105 .dumb_map_offset = drm_gem_cma_dumb_map_offset, 105 .dumb_map_offset = drm_gem_cma_dumb_map_offset,
106 .gem_free_object = drm_gem_cma_free_object, 106 .gem_free_object_unlocked = drm_gem_cma_free_object,
107 .gem_vm_ops = &drm_gem_cma_vm_ops, 107 .gem_vm_ops = &drm_gem_cma_vm_ops,
108 108
109 /* PRIME Operations */ 109 /* PRIME Operations */
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 709bc903524d..308e197908fc 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -549,7 +549,7 @@ static struct drm_driver tilcdc_driver = {
549 .get_vblank_counter = drm_vblank_no_hw_counter, 549 .get_vblank_counter = drm_vblank_no_hw_counter,
550 .enable_vblank = tilcdc_enable_vblank, 550 .enable_vblank = tilcdc_enable_vblank,
551 .disable_vblank = tilcdc_disable_vblank, 551 .disable_vblank = tilcdc_disable_vblank,
552 .gem_free_object = drm_gem_cma_free_object, 552 .gem_free_object_unlocked = drm_gem_cma_free_object,
553 .gem_vm_ops = &drm_gem_cma_vm_ops, 553 .gem_vm_ops = &drm_gem_cma_vm_ops,
554 .dumb_create = drm_gem_cma_dumb_create, 554 .dumb_create = drm_gem_cma_dumb_create,
555 .dumb_map_offset = drm_gem_cma_dumb_map_offset, 555 .dumb_map_offset = drm_gem_cma_dumb_map_offset,
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 3cc7afa77a35..5820b7020ae5 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -143,7 +143,7 @@ static struct drm_driver driver = {
143 .gem_prime_vunmap = virtgpu_gem_prime_vunmap, 143 .gem_prime_vunmap = virtgpu_gem_prime_vunmap,
144 .gem_prime_mmap = virtgpu_gem_prime_mmap, 144 .gem_prime_mmap = virtgpu_gem_prime_mmap,
145 145
146 .gem_free_object = virtio_gpu_gem_free_object, 146 .gem_free_object_unlocked = virtio_gpu_gem_free_object,
147 .gem_open_object = virtio_gpu_gem_object_open, 147 .gem_open_object = virtio_gpu_gem_object_open,
148 .gem_close_object = virtio_gpu_gem_object_close, 148 .gem_close_object = virtio_gpu_gem_object_close,
149 .fops = &virtio_gpu_driver_fops, 149 .fops = &virtio_gpu_driver_fops,
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 6bd881be24ea..5eb1f9e17a98 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -41,6 +41,7 @@
41 41
42#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0) 42#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0)
43#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1) 43#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1)
44#define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2)
44 45
45#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) 46#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
46 47
@@ -82,6 +83,7 @@ struct its_node {
82 u64 flags; 83 u64 flags;
83 u32 ite_size; 84 u32 ite_size;
84 u32 device_ids; 85 u32 device_ids;
86 int numa_node;
85}; 87};
86 88
87#define ITS_ITT_ALIGN SZ_256 89#define ITS_ITT_ALIGN SZ_256
@@ -613,11 +615,23 @@ static void its_unmask_irq(struct irq_data *d)
613static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val, 615static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
614 bool force) 616 bool force)
615{ 617{
616 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); 618 unsigned int cpu;
619 const struct cpumask *cpu_mask = cpu_online_mask;
617 struct its_device *its_dev = irq_data_get_irq_chip_data(d); 620 struct its_device *its_dev = irq_data_get_irq_chip_data(d);
618 struct its_collection *target_col; 621 struct its_collection *target_col;
619 u32 id = its_get_event_id(d); 622 u32 id = its_get_event_id(d);
620 623
624 /* lpi cannot be routed to a redistributor that is on a foreign node */
625 if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) {
626 if (its_dev->its->numa_node >= 0) {
627 cpu_mask = cpumask_of_node(its_dev->its->numa_node);
628 if (!cpumask_intersects(mask_val, cpu_mask))
629 return -EINVAL;
630 }
631 }
632
633 cpu = cpumask_any_and(mask_val, cpu_mask);
634
621 if (cpu >= nr_cpu_ids) 635 if (cpu >= nr_cpu_ids)
622 return -EINVAL; 636 return -EINVAL;
623 637
@@ -1101,6 +1115,16 @@ static void its_cpu_init_collection(void)
1101 list_for_each_entry(its, &its_nodes, entry) { 1115 list_for_each_entry(its, &its_nodes, entry) {
1102 u64 target; 1116 u64 target;
1103 1117
1118 /* avoid cross node collections and its mapping */
1119 if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) {
1120 struct device_node *cpu_node;
1121
1122 cpu_node = of_get_cpu_node(cpu, NULL);
1123 if (its->numa_node != NUMA_NO_NODE &&
1124 its->numa_node != of_node_to_nid(cpu_node))
1125 continue;
1126 }
1127
1104 /* 1128 /*
1105 * We now have to bind each collection to its target 1129 * We now have to bind each collection to its target
1106 * redistributor. 1130 * redistributor.
@@ -1351,9 +1375,14 @@ static void its_irq_domain_activate(struct irq_domain *domain,
1351{ 1375{
1352 struct its_device *its_dev = irq_data_get_irq_chip_data(d); 1376 struct its_device *its_dev = irq_data_get_irq_chip_data(d);
1353 u32 event = its_get_event_id(d); 1377 u32 event = its_get_event_id(d);
1378 const struct cpumask *cpu_mask = cpu_online_mask;
1379
1380 /* get the cpu_mask of local node */
1381 if (its_dev->its->numa_node >= 0)
1382 cpu_mask = cpumask_of_node(its_dev->its->numa_node);
1354 1383
1355 /* Bind the LPI to the first possible CPU */ 1384 /* Bind the LPI to the first possible CPU */
1356 its_dev->event_map.col_map[event] = cpumask_first(cpu_online_mask); 1385 its_dev->event_map.col_map[event] = cpumask_first(cpu_mask);
1357 1386
1358 /* Map the GIC IRQ and event to the device */ 1387 /* Map the GIC IRQ and event to the device */
1359 its_send_mapvi(its_dev, d->hwirq, event); 1388 its_send_mapvi(its_dev, d->hwirq, event);
@@ -1443,6 +1472,13 @@ static void __maybe_unused its_enable_quirk_cavium_22375(void *data)
1443 its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_22375; 1472 its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_22375;
1444} 1473}
1445 1474
1475static void __maybe_unused its_enable_quirk_cavium_23144(void *data)
1476{
1477 struct its_node *its = data;
1478
1479 its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144;
1480}
1481
1446static const struct gic_quirk its_quirks[] = { 1482static const struct gic_quirk its_quirks[] = {
1447#ifdef CONFIG_CAVIUM_ERRATUM_22375 1483#ifdef CONFIG_CAVIUM_ERRATUM_22375
1448 { 1484 {
@@ -1452,6 +1488,14 @@ static const struct gic_quirk its_quirks[] = {
1452 .init = its_enable_quirk_cavium_22375, 1488 .init = its_enable_quirk_cavium_22375,
1453 }, 1489 },
1454#endif 1490#endif
1491#ifdef CONFIG_CAVIUM_ERRATUM_23144
1492 {
1493 .desc = "ITS: Cavium erratum 23144",
1494 .iidr = 0xa100034c, /* ThunderX pass 1.x */
1495 .mask = 0xffff0fff,
1496 .init = its_enable_quirk_cavium_23144,
1497 },
1498#endif
1455 { 1499 {
1456 } 1500 }
1457}; 1501};
@@ -1514,6 +1558,7 @@ static int __init its_probe(struct device_node *node,
1514 its->base = its_base; 1558 its->base = its_base;
1515 its->phys_base = res.start; 1559 its->phys_base = res.start;
1516 its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1; 1560 its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1;
1561 its->numa_node = of_node_to_nid(node);
1517 1562
1518 its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL); 1563 its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL);
1519 if (!its->cmd_base) { 1564 if (!its->cmd_base) {
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index fb042ba9a3db..2c5ba0e704bf 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -155,7 +155,7 @@ static void gic_enable_redist(bool enable)
155 155
156 while (count--) { 156 while (count--) {
157 val = readl_relaxed(rbase + GICR_WAKER); 157 val = readl_relaxed(rbase + GICR_WAKER);
158 if (enable ^ (val & GICR_WAKER_ChildrenAsleep)) 158 if (enable ^ (bool)(val & GICR_WAKER_ChildrenAsleep))
159 break; 159 break;
160 cpu_relax(); 160 cpu_relax();
161 udelay(1); 161 udelay(1);
diff --git a/drivers/irqchip/irq-pic32-evic.c b/drivers/irqchip/irq-pic32-evic.c
index e7155db01d55..73addb4b625b 100644
--- a/drivers/irqchip/irq-pic32-evic.c
+++ b/drivers/irqchip/irq-pic32-evic.c
@@ -91,7 +91,7 @@ static int pic32_set_type_edge(struct irq_data *data,
91 /* set polarity for external interrupts only */ 91 /* set polarity for external interrupts only */
92 for (i = 0; i < ARRAY_SIZE(priv->ext_irqs); i++) { 92 for (i = 0; i < ARRAY_SIZE(priv->ext_irqs); i++) {
93 if (priv->ext_irqs[i] == data->hwirq) { 93 if (priv->ext_irqs[i] == data->hwirq) {
94 ret = pic32_set_ext_polarity(i + 1, flow_type); 94 ret = pic32_set_ext_polarity(i, flow_type);
95 if (ret) 95 if (ret)
96 return ret; 96 return ret;
97 } 97 }
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index c984321d1881..5d438ad3ee32 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1276,7 +1276,7 @@ static int mmc_select_hs200(struct mmc_card *card)
1276 * switch to HS200 mode if bus width is set successfully. 1276 * switch to HS200 mode if bus width is set successfully.
1277 */ 1277 */
1278 err = mmc_select_bus_width(card); 1278 err = mmc_select_bus_width(card);
1279 if (!err) { 1279 if (err >= 0) {
1280 val = EXT_CSD_TIMING_HS200 | 1280 val = EXT_CSD_TIMING_HS200 |
1281 card->drive_strength << EXT_CSD_DRV_STR_SHIFT; 1281 card->drive_strength << EXT_CSD_DRV_STR_SHIFT;
1282 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, 1282 err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
@@ -1583,7 +1583,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
1583 } else if (mmc_card_hs(card)) { 1583 } else if (mmc_card_hs(card)) {
1584 /* Select the desired bus width optionally */ 1584 /* Select the desired bus width optionally */
1585 err = mmc_select_bus_width(card); 1585 err = mmc_select_bus_width(card);
1586 if (!err) { 1586 if (err >= 0) {
1587 err = mmc_select_hs_ddr(card); 1587 err = mmc_select_hs_ddr(card);
1588 if (err) 1588 if (err)
1589 goto free_card; 1589 goto free_card;
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
index 7fc8b7aa83f0..2ee4c21ec55e 100644
--- a/drivers/mmc/host/sunxi-mmc.c
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -970,8 +970,8 @@ static const struct sunxi_mmc_clk_delay sun9i_mmc_clk_delays[] = {
970 [SDXC_CLK_400K] = { .output = 180, .sample = 180 }, 970 [SDXC_CLK_400K] = { .output = 180, .sample = 180 },
971 [SDXC_CLK_25M] = { .output = 180, .sample = 75 }, 971 [SDXC_CLK_25M] = { .output = 180, .sample = 75 },
972 [SDXC_CLK_50M] = { .output = 150, .sample = 120 }, 972 [SDXC_CLK_50M] = { .output = 150, .sample = 120 },
973 [SDXC_CLK_50M_DDR] = { .output = 90, .sample = 120 }, 973 [SDXC_CLK_50M_DDR] = { .output = 54, .sample = 36 },
974 [SDXC_CLK_50M_DDR_8BIT] = { .output = 90, .sample = 120 }, 974 [SDXC_CLK_50M_DDR_8BIT] = { .output = 72, .sample = 72 },
975}; 975};
976 976
977static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host, 977static int sunxi_mmc_resource_request(struct sunxi_mmc_host *host,
@@ -1129,11 +1129,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
1129 MMC_CAP_1_8V_DDR | 1129 MMC_CAP_1_8V_DDR |
1130 MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ; 1130 MMC_CAP_ERASE | MMC_CAP_SDIO_IRQ;
1131 1131
1132 /* TODO MMC DDR is not working on A80 */
1133 if (of_device_is_compatible(pdev->dev.of_node,
1134 "allwinner,sun9i-a80-mmc"))
1135 mmc->caps &= ~MMC_CAP_1_8V_DDR;
1136
1137 ret = mmc_of_parse(mmc); 1132 ret = mmc_of_parse(mmc);
1138 if (ret) 1133 if (ret)
1139 goto error_free_dma; 1134 goto error_free_dma;
diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c
index 16419f550eff..058460bdd5a6 100644
--- a/drivers/net/ethernet/arc/emac_mdio.c
+++ b/drivers/net/ethernet/arc/emac_mdio.c
@@ -141,7 +141,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv)
141 priv->bus = bus; 141 priv->bus = bus;
142 bus->priv = priv; 142 bus->priv = priv;
143 bus->parent = priv->dev; 143 bus->parent = priv->dev;
144 bus->name = "Synopsys MII Bus", 144 bus->name = "Synopsys MII Bus";
145 bus->read = &arc_mdio_read; 145 bus->read = &arc_mdio_read;
146 bus->write = &arc_mdio_write; 146 bus->write = &arc_mdio_write;
147 bus->reset = &arc_mdio_reset; 147 bus->reset = &arc_mdio_reset;
diff --git a/drivers/net/ethernet/atheros/alx/alx.h b/drivers/net/ethernet/atheros/alx/alx.h
index 8fc93c5f6abc..d02c4240b7df 100644
--- a/drivers/net/ethernet/atheros/alx/alx.h
+++ b/drivers/net/ethernet/atheros/alx/alx.h
@@ -96,6 +96,10 @@ struct alx_priv {
96 unsigned int rx_ringsz; 96 unsigned int rx_ringsz;
97 unsigned int rxbuf_size; 97 unsigned int rxbuf_size;
98 98
99 struct page *rx_page;
100 unsigned int rx_page_offset;
101 unsigned int rx_frag_size;
102
99 struct napi_struct napi; 103 struct napi_struct napi;
100 struct alx_tx_queue txq; 104 struct alx_tx_queue txq;
101 struct alx_rx_queue rxq; 105 struct alx_rx_queue rxq;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index 9fe8b5e310d1..c98acdc0d14f 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -70,6 +70,35 @@ static void alx_free_txbuf(struct alx_priv *alx, int entry)
70 } 70 }
71} 71}
72 72
73static struct sk_buff *alx_alloc_skb(struct alx_priv *alx, gfp_t gfp)
74{
75 struct sk_buff *skb;
76 struct page *page;
77
78 if (alx->rx_frag_size > PAGE_SIZE)
79 return __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp);
80
81 page = alx->rx_page;
82 if (!page) {
83 alx->rx_page = page = alloc_page(gfp);
84 if (unlikely(!page))
85 return NULL;
86 alx->rx_page_offset = 0;
87 }
88
89 skb = build_skb(page_address(page) + alx->rx_page_offset,
90 alx->rx_frag_size);
91 if (likely(skb)) {
92 alx->rx_page_offset += alx->rx_frag_size;
93 if (alx->rx_page_offset >= PAGE_SIZE)
94 alx->rx_page = NULL;
95 else
96 get_page(page);
97 }
98 return skb;
99}
100
101
73static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp) 102static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
74{ 103{
75 struct alx_rx_queue *rxq = &alx->rxq; 104 struct alx_rx_queue *rxq = &alx->rxq;
@@ -86,7 +115,7 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
86 while (!cur_buf->skb && next != rxq->read_idx) { 115 while (!cur_buf->skb && next != rxq->read_idx) {
87 struct alx_rfd *rfd = &rxq->rfd[cur]; 116 struct alx_rfd *rfd = &rxq->rfd[cur];
88 117
89 skb = __netdev_alloc_skb(alx->dev, alx->rxbuf_size, gfp); 118 skb = alx_alloc_skb(alx, gfp);
90 if (!skb) 119 if (!skb)
91 break; 120 break;
92 dma = dma_map_single(&alx->hw.pdev->dev, 121 dma = dma_map_single(&alx->hw.pdev->dev,
@@ -124,6 +153,7 @@ static int alx_refill_rx_ring(struct alx_priv *alx, gfp_t gfp)
124 alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur); 153 alx_write_mem16(&alx->hw, ALX_RFD_PIDX, cur);
125 } 154 }
126 155
156
127 return count; 157 return count;
128} 158}
129 159
@@ -592,6 +622,11 @@ static void alx_free_rings(struct alx_priv *alx)
592 kfree(alx->txq.bufs); 622 kfree(alx->txq.bufs);
593 kfree(alx->rxq.bufs); 623 kfree(alx->rxq.bufs);
594 624
625 if (alx->rx_page) {
626 put_page(alx->rx_page);
627 alx->rx_page = NULL;
628 }
629
595 dma_free_coherent(&alx->hw.pdev->dev, 630 dma_free_coherent(&alx->hw.pdev->dev,
596 alx->descmem.size, 631 alx->descmem.size,
597 alx->descmem.virt, 632 alx->descmem.virt,
@@ -646,6 +681,7 @@ static int alx_request_irq(struct alx_priv *alx)
646 alx->dev->name, alx); 681 alx->dev->name, alx);
647 if (!err) 682 if (!err)
648 goto out; 683 goto out;
684
649 /* fall back to legacy interrupt */ 685 /* fall back to legacy interrupt */
650 pci_disable_msi(alx->hw.pdev); 686 pci_disable_msi(alx->hw.pdev);
651 } 687 }
@@ -689,6 +725,7 @@ static int alx_init_sw(struct alx_priv *alx)
689 struct pci_dev *pdev = alx->hw.pdev; 725 struct pci_dev *pdev = alx->hw.pdev;
690 struct alx_hw *hw = &alx->hw; 726 struct alx_hw *hw = &alx->hw;
691 int err; 727 int err;
728 unsigned int head_size;
692 729
693 err = alx_identify_hw(alx); 730 err = alx_identify_hw(alx);
694 if (err) { 731 if (err) {
@@ -704,7 +741,12 @@ static int alx_init_sw(struct alx_priv *alx)
704 741
705 hw->smb_timer = 400; 742 hw->smb_timer = 400;
706 hw->mtu = alx->dev->mtu; 743 hw->mtu = alx->dev->mtu;
744
707 alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu); 745 alx->rxbuf_size = ALX_MAX_FRAME_LEN(hw->mtu);
746 head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +
747 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
748 alx->rx_frag_size = roundup_pow_of_two(head_size);
749
708 alx->tx_ringsz = 256; 750 alx->tx_ringsz = 256;
709 alx->rx_ringsz = 512; 751 alx->rx_ringsz = 512;
710 hw->imt = 200; 752 hw->imt = 200;
@@ -806,6 +848,7 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
806{ 848{
807 struct alx_priv *alx = netdev_priv(netdev); 849 struct alx_priv *alx = netdev_priv(netdev);
808 int max_frame = ALX_MAX_FRAME_LEN(mtu); 850 int max_frame = ALX_MAX_FRAME_LEN(mtu);
851 unsigned int head_size;
809 852
810 if ((max_frame < ALX_MIN_FRAME_SIZE) || 853 if ((max_frame < ALX_MIN_FRAME_SIZE) ||
811 (max_frame > ALX_MAX_FRAME_SIZE)) 854 (max_frame > ALX_MAX_FRAME_SIZE))
@@ -817,6 +860,9 @@ static int alx_change_mtu(struct net_device *netdev, int mtu)
817 netdev->mtu = mtu; 860 netdev->mtu = mtu;
818 alx->hw.mtu = mtu; 861 alx->hw.mtu = mtu;
819 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE); 862 alx->rxbuf_size = max(max_frame, ALX_DEF_RXBUF_SIZE);
863 head_size = SKB_DATA_ALIGN(alx->rxbuf_size + NET_SKB_PAD) +
864 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
865 alx->rx_frag_size = roundup_pow_of_two(head_size);
820 netdev_update_features(netdev); 866 netdev_update_features(netdev);
821 if (netif_running(netdev)) 867 if (netif_running(netdev))
822 alx_reinit(alx); 868 alx_reinit(alx);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 0a5b770cefaa..c5fe915870ad 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -13941,14 +13941,14 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13941 bp->doorbells = bnx2x_vf_doorbells(bp); 13941 bp->doorbells = bnx2x_vf_doorbells(bp);
13942 rc = bnx2x_vf_pci_alloc(bp); 13942 rc = bnx2x_vf_pci_alloc(bp);
13943 if (rc) 13943 if (rc)
13944 goto init_one_exit; 13944 goto init_one_freemem;
13945 } else { 13945 } else {
13946 doorbell_size = BNX2X_L2_MAX_CID(bp) * (1 << BNX2X_DB_SHIFT); 13946 doorbell_size = BNX2X_L2_MAX_CID(bp) * (1 << BNX2X_DB_SHIFT);
13947 if (doorbell_size > pci_resource_len(pdev, 2)) { 13947 if (doorbell_size > pci_resource_len(pdev, 2)) {
13948 dev_err(&bp->pdev->dev, 13948 dev_err(&bp->pdev->dev,
13949 "Cannot map doorbells, bar size too small, aborting\n"); 13949 "Cannot map doorbells, bar size too small, aborting\n");
13950 rc = -ENOMEM; 13950 rc = -ENOMEM;
13951 goto init_one_exit; 13951 goto init_one_freemem;
13952 } 13952 }
13953 bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2), 13953 bp->doorbells = ioremap_nocache(pci_resource_start(pdev, 2),
13954 doorbell_size); 13954 doorbell_size);
@@ -13957,19 +13957,19 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13957 dev_err(&bp->pdev->dev, 13957 dev_err(&bp->pdev->dev,
13958 "Cannot map doorbell space, aborting\n"); 13958 "Cannot map doorbell space, aborting\n");
13959 rc = -ENOMEM; 13959 rc = -ENOMEM;
13960 goto init_one_exit; 13960 goto init_one_freemem;
13961 } 13961 }
13962 13962
13963 if (IS_VF(bp)) { 13963 if (IS_VF(bp)) {
13964 rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count); 13964 rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count);
13965 if (rc) 13965 if (rc)
13966 goto init_one_exit; 13966 goto init_one_freemem;
13967 } 13967 }
13968 13968
13969 /* Enable SRIOV if capability found in configuration space */ 13969 /* Enable SRIOV if capability found in configuration space */
13970 rc = bnx2x_iov_init_one(bp, int_mode, BNX2X_MAX_NUM_OF_VFS); 13970 rc = bnx2x_iov_init_one(bp, int_mode, BNX2X_MAX_NUM_OF_VFS);
13971 if (rc) 13971 if (rc)
13972 goto init_one_exit; 13972 goto init_one_freemem;
13973 13973
13974 /* calc qm_cid_count */ 13974 /* calc qm_cid_count */
13975 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp); 13975 bp->qm_cid_count = bnx2x_set_qm_cid_count(bp);
@@ -13988,7 +13988,7 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13988 rc = bnx2x_set_int_mode(bp); 13988 rc = bnx2x_set_int_mode(bp);
13989 if (rc) { 13989 if (rc) {
13990 dev_err(&pdev->dev, "Cannot set interrupts\n"); 13990 dev_err(&pdev->dev, "Cannot set interrupts\n");
13991 goto init_one_exit; 13991 goto init_one_freemem;
13992 } 13992 }
13993 BNX2X_DEV_INFO("set interrupts successfully\n"); 13993 BNX2X_DEV_INFO("set interrupts successfully\n");
13994 13994
@@ -13996,7 +13996,7 @@ static int bnx2x_init_one(struct pci_dev *pdev,
13996 rc = register_netdev(dev); 13996 rc = register_netdev(dev);
13997 if (rc) { 13997 if (rc) {
13998 dev_err(&pdev->dev, "Cannot register net device\n"); 13998 dev_err(&pdev->dev, "Cannot register net device\n");
13999 goto init_one_exit; 13999 goto init_one_freemem;
14000 } 14000 }
14001 BNX2X_DEV_INFO("device name after netdev register %s\n", dev->name); 14001 BNX2X_DEV_INFO("device name after netdev register %s\n", dev->name);
14002 14002
@@ -14029,6 +14029,9 @@ static int bnx2x_init_one(struct pci_dev *pdev,
14029 14029
14030 return 0; 14030 return 0;
14031 14031
14032init_one_freemem:
14033 bnx2x_free_mem_bp(bp);
14034
14032init_one_exit: 14035init_one_exit:
14033 bnx2x_disable_pcie_error_reporting(bp); 14036 bnx2x_disable_pcie_error_reporting(bp);
14034 14037
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 085f9125cf42..06f031715b57 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -205,8 +205,10 @@ static int nps_enet_poll(struct napi_struct *napi, int budget)
205 * re-adding ourselves to the poll list. 205 * re-adding ourselves to the poll list.
206 */ 206 */
207 207
208 if (priv->tx_skb && !tx_ctrl_ct) 208 if (priv->tx_skb && !tx_ctrl_ct) {
209 nps_enet_reg_set(priv, NPS_ENET_REG_BUF_INT_ENABLE, 0);
209 napi_reschedule(napi); 210 napi_reschedule(napi);
211 }
210 } 212 }
211 213
212 return work_done; 214 return work_done;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index ca2cccc594fd..3c0255e98535 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1197,10 +1197,8 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
1197 fec16_to_cpu(bdp->cbd_datlen), 1197 fec16_to_cpu(bdp->cbd_datlen),
1198 DMA_TO_DEVICE); 1198 DMA_TO_DEVICE);
1199 bdp->cbd_bufaddr = cpu_to_fec32(0); 1199 bdp->cbd_bufaddr = cpu_to_fec32(0);
1200 if (!skb) { 1200 if (!skb)
1201 bdp = fec_enet_get_nextdesc(bdp, &txq->bd); 1201 goto skb_done;
1202 continue;
1203 }
1204 1202
1205 /* Check for errors. */ 1203 /* Check for errors. */
1206 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC | 1204 if (status & (BD_ENET_TX_HB | BD_ENET_TX_LC |
@@ -1239,7 +1237,7 @@ fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)
1239 1237
1240 /* Free the sk buffer associated with this last transmit */ 1238 /* Free the sk buffer associated with this last transmit */
1241 dev_kfree_skb_any(skb); 1239 dev_kfree_skb_any(skb);
1242 1240skb_done:
1243 /* Make sure the update to bdp and tx_skbuff are performed 1241 /* Make sure the update to bdp and tx_skbuff are performed
1244 * before dirty_tx 1242 * before dirty_tx
1245 */ 1243 */
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
index 3d746c887873..67a648c7d3a9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
@@ -46,7 +46,6 @@ static u32 hns_nic_get_link(struct net_device *net_dev)
46 u32 link_stat = priv->link; 46 u32 link_stat = priv->link;
47 struct hnae_handle *h; 47 struct hnae_handle *h;
48 48
49 assert(priv && priv->ae_handle);
50 h = priv->ae_handle; 49 h = priv->ae_handle;
51 50
52 if (priv->phy) { 51 if (priv->phy) {
@@ -646,8 +645,6 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
646{ 645{
647 struct hns_nic_priv *priv = netdev_priv(net_dev); 646 struct hns_nic_priv *priv = netdev_priv(net_dev);
648 647
649 assert(priv);
650
651 strncpy(drvinfo->version, HNAE_DRIVER_VERSION, 648 strncpy(drvinfo->version, HNAE_DRIVER_VERSION,
652 sizeof(drvinfo->version)); 649 sizeof(drvinfo->version));
653 drvinfo->version[sizeof(drvinfo->version) - 1] = '\0'; 650 drvinfo->version[sizeof(drvinfo->version) - 1] = '\0';
@@ -720,8 +717,6 @@ static int hns_set_pauseparam(struct net_device *net_dev,
720 struct hnae_handle *h; 717 struct hnae_handle *h;
721 struct hnae_ae_ops *ops; 718 struct hnae_ae_ops *ops;
722 719
723 assert(priv || priv->ae_handle);
724
725 h = priv->ae_handle; 720 h = priv->ae_handle;
726 ops = h->dev->ops; 721 ops = h->dev->ops;
727 722
@@ -780,8 +775,6 @@ static int hns_set_coalesce(struct net_device *net_dev,
780 struct hnae_ae_ops *ops; 775 struct hnae_ae_ops *ops;
781 int ret; 776 int ret;
782 777
783 assert(priv || priv->ae_handle);
784
785 ops = priv->ae_handle->dev->ops; 778 ops = priv->ae_handle->dev->ops;
786 779
787 if (ec->tx_coalesce_usecs != ec->rx_coalesce_usecs) 780 if (ec->tx_coalesce_usecs != ec->rx_coalesce_usecs)
@@ -1111,8 +1104,6 @@ void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
1111 struct hns_nic_priv *priv = netdev_priv(net_dev); 1104 struct hns_nic_priv *priv = netdev_priv(net_dev);
1112 struct hnae_ae_ops *ops; 1105 struct hnae_ae_ops *ops;
1113 1106
1114 assert(priv || priv->ae_handle);
1115
1116 ops = priv->ae_handle->dev->ops; 1107 ops = priv->ae_handle->dev->ops;
1117 1108
1118 cmd->version = HNS_CHIP_VERSION; 1109 cmd->version = HNS_CHIP_VERSION;
@@ -1135,8 +1126,6 @@ static int hns_get_regs_len(struct net_device *net_dev)
1135 struct hns_nic_priv *priv = netdev_priv(net_dev); 1126 struct hns_nic_priv *priv = netdev_priv(net_dev);
1136 struct hnae_ae_ops *ops; 1127 struct hnae_ae_ops *ops;
1137 1128
1138 assert(priv || priv->ae_handle);
1139
1140 ops = priv->ae_handle->dev->ops; 1129 ops = priv->ae_handle->dev->ops;
1141 if (!ops->get_regs_len) { 1130 if (!ops->get_regs_len) {
1142 netdev_err(net_dev, "ops->get_regs_len is null!\n"); 1131 netdev_err(net_dev, "ops->get_regs_len is null!\n");
diff --git a/drivers/net/ethernet/marvell/mvneta_bm.c b/drivers/net/ethernet/marvell/mvneta_bm.c
index 01fccec632ec..466939f8f0cf 100644
--- a/drivers/net/ethernet/marvell/mvneta_bm.c
+++ b/drivers/net/ethernet/marvell/mvneta_bm.c
@@ -189,6 +189,7 @@ struct mvneta_bm_pool *mvneta_bm_pool_use(struct mvneta_bm *priv, u8 pool_id,
189 SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); 189 SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
190 hwbm_pool->construct = mvneta_bm_construct; 190 hwbm_pool->construct = mvneta_bm_construct;
191 hwbm_pool->priv = new_pool; 191 hwbm_pool->priv = new_pool;
192 spin_lock_init(&hwbm_pool->lock);
192 193
193 /* Create new pool */ 194 /* Create new pool */
194 err = mvneta_bm_pool_create(priv, new_pool); 195 err = mvneta_bm_pool_create(priv, new_pool);
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
index c761194bb323..fc95affaf76b 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
@@ -362,7 +362,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev,
362 362
363 for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it)) 363 for (i = 0; i < NUM_MAIN_STATS; i++, bitmap_iterator_inc(&it))
364 if (bitmap_iterator_test(&it)) 364 if (bitmap_iterator_test(&it))
365 data[index++] = ((unsigned long *)&priv->stats)[i]; 365 data[index++] = ((unsigned long *)&dev->stats)[i];
366 366
367 for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it)) 367 for (i = 0; i < NUM_PORT_STATS; i++, bitmap_iterator_inc(&it))
368 if (bitmap_iterator_test(&it)) 368 if (bitmap_iterator_test(&it))
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index 92e0624f4cf0..19ceced6736c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1296,15 +1296,16 @@ static void mlx4_en_tx_timeout(struct net_device *dev)
1296} 1296}
1297 1297
1298 1298
1299static struct net_device_stats *mlx4_en_get_stats(struct net_device *dev) 1299static struct rtnl_link_stats64 *
1300mlx4_en_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
1300{ 1301{
1301 struct mlx4_en_priv *priv = netdev_priv(dev); 1302 struct mlx4_en_priv *priv = netdev_priv(dev);
1302 1303
1303 spin_lock_bh(&priv->stats_lock); 1304 spin_lock_bh(&priv->stats_lock);
1304 memcpy(&priv->ret_stats, &priv->stats, sizeof(priv->stats)); 1305 netdev_stats_to_stats64(stats, &dev->stats);
1305 spin_unlock_bh(&priv->stats_lock); 1306 spin_unlock_bh(&priv->stats_lock);
1306 1307
1307 return &priv->ret_stats; 1308 return stats;
1308} 1309}
1309 1310
1310static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv) 1311static void mlx4_en_set_default_moderation(struct mlx4_en_priv *priv)
@@ -1876,7 +1877,6 @@ static void mlx4_en_clear_stats(struct net_device *dev)
1876 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1)) 1877 if (mlx4_en_DUMP_ETH_STATS(mdev, priv->port, 1))
1877 en_dbg(HW, priv, "Failed dumping statistics\n"); 1878 en_dbg(HW, priv, "Failed dumping statistics\n");
1878 1879
1879 memset(&priv->stats, 0, sizeof(priv->stats));
1880 memset(&priv->pstats, 0, sizeof(priv->pstats)); 1880 memset(&priv->pstats, 0, sizeof(priv->pstats));
1881 memset(&priv->pkstats, 0, sizeof(priv->pkstats)); 1881 memset(&priv->pkstats, 0, sizeof(priv->pkstats));
1882 memset(&priv->port_stats, 0, sizeof(priv->port_stats)); 1882 memset(&priv->port_stats, 0, sizeof(priv->port_stats));
@@ -1892,6 +1892,11 @@ static void mlx4_en_clear_stats(struct net_device *dev)
1892 priv->tx_ring[i]->bytes = 0; 1892 priv->tx_ring[i]->bytes = 0;
1893 priv->tx_ring[i]->packets = 0; 1893 priv->tx_ring[i]->packets = 0;
1894 priv->tx_ring[i]->tx_csum = 0; 1894 priv->tx_ring[i]->tx_csum = 0;
1895 priv->tx_ring[i]->tx_dropped = 0;
1896 priv->tx_ring[i]->queue_stopped = 0;
1897 priv->tx_ring[i]->wake_queue = 0;
1898 priv->tx_ring[i]->tso_packets = 0;
1899 priv->tx_ring[i]->xmit_more = 0;
1895 } 1900 }
1896 for (i = 0; i < priv->rx_ring_num; i++) { 1901 for (i = 0; i < priv->rx_ring_num; i++) {
1897 priv->rx_ring[i]->bytes = 0; 1902 priv->rx_ring[i]->bytes = 0;
@@ -2482,7 +2487,7 @@ static const struct net_device_ops mlx4_netdev_ops = {
2482 .ndo_stop = mlx4_en_close, 2487 .ndo_stop = mlx4_en_close,
2483 .ndo_start_xmit = mlx4_en_xmit, 2488 .ndo_start_xmit = mlx4_en_xmit,
2484 .ndo_select_queue = mlx4_en_select_queue, 2489 .ndo_select_queue = mlx4_en_select_queue,
2485 .ndo_get_stats = mlx4_en_get_stats, 2490 .ndo_get_stats64 = mlx4_en_get_stats64,
2486 .ndo_set_rx_mode = mlx4_en_set_rx_mode, 2491 .ndo_set_rx_mode = mlx4_en_set_rx_mode,
2487 .ndo_set_mac_address = mlx4_en_set_mac, 2492 .ndo_set_mac_address = mlx4_en_set_mac,
2488 .ndo_validate_addr = eth_validate_addr, 2493 .ndo_validate_addr = eth_validate_addr,
@@ -2514,7 +2519,7 @@ static const struct net_device_ops mlx4_netdev_ops_master = {
2514 .ndo_stop = mlx4_en_close, 2519 .ndo_stop = mlx4_en_close,
2515 .ndo_start_xmit = mlx4_en_xmit, 2520 .ndo_start_xmit = mlx4_en_xmit,
2516 .ndo_select_queue = mlx4_en_select_queue, 2521 .ndo_select_queue = mlx4_en_select_queue,
2517 .ndo_get_stats = mlx4_en_get_stats, 2522 .ndo_get_stats64 = mlx4_en_get_stats64,
2518 .ndo_set_rx_mode = mlx4_en_set_rx_mode, 2523 .ndo_set_rx_mode = mlx4_en_set_rx_mode,
2519 .ndo_set_mac_address = mlx4_en_set_mac, 2524 .ndo_set_mac_address = mlx4_en_set_mac,
2520 .ndo_validate_addr = eth_validate_addr, 2525 .ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_port.c b/drivers/net/ethernet/mellanox/mlx4/en_port.c
index 20b6c2e678b8..5aa8b751f417 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_port.c
@@ -152,8 +152,9 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
152 struct mlx4_counter tmp_counter_stats; 152 struct mlx4_counter tmp_counter_stats;
153 struct mlx4_en_stat_out_mbox *mlx4_en_stats; 153 struct mlx4_en_stat_out_mbox *mlx4_en_stats;
154 struct mlx4_en_stat_out_flow_control_mbox *flowstats; 154 struct mlx4_en_stat_out_flow_control_mbox *flowstats;
155 struct mlx4_en_priv *priv = netdev_priv(mdev->pndev[port]); 155 struct net_device *dev = mdev->pndev[port];
156 struct net_device_stats *stats = &priv->stats; 156 struct mlx4_en_priv *priv = netdev_priv(dev);
157 struct net_device_stats *stats = &dev->stats;
157 struct mlx4_cmd_mailbox *mailbox; 158 struct mlx4_cmd_mailbox *mailbox;
158 u64 in_mod = reset << 8 | port; 159 u64 in_mod = reset << 8 | port;
159 int err; 160 int err;
@@ -188,6 +189,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
188 } 189 }
189 stats->tx_packets = 0; 190 stats->tx_packets = 0;
190 stats->tx_bytes = 0; 191 stats->tx_bytes = 0;
192 stats->tx_dropped = 0;
191 priv->port_stats.tx_chksum_offload = 0; 193 priv->port_stats.tx_chksum_offload = 0;
192 priv->port_stats.queue_stopped = 0; 194 priv->port_stats.queue_stopped = 0;
193 priv->port_stats.wake_queue = 0; 195 priv->port_stats.wake_queue = 0;
@@ -199,6 +201,7 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
199 201
200 stats->tx_packets += ring->packets; 202 stats->tx_packets += ring->packets;
201 stats->tx_bytes += ring->bytes; 203 stats->tx_bytes += ring->bytes;
204 stats->tx_dropped += ring->tx_dropped;
202 priv->port_stats.tx_chksum_offload += ring->tx_csum; 205 priv->port_stats.tx_chksum_offload += ring->tx_csum;
203 priv->port_stats.queue_stopped += ring->queue_stopped; 206 priv->port_stats.queue_stopped += ring->queue_stopped;
204 priv->port_stats.wake_queue += ring->wake_queue; 207 priv->port_stats.wake_queue += ring->wake_queue;
@@ -237,21 +240,12 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_en_dev *mdev, u8 port, u8 reset)
237 stats->multicast = en_stats_adder(&mlx4_en_stats->MCAST_prio_0, 240 stats->multicast = en_stats_adder(&mlx4_en_stats->MCAST_prio_0,
238 &mlx4_en_stats->MCAST_prio_1, 241 &mlx4_en_stats->MCAST_prio_1,
239 NUM_PRIORITIES); 242 NUM_PRIORITIES);
240 stats->collisions = 0;
241 stats->rx_dropped = be32_to_cpu(mlx4_en_stats->RDROP) + 243 stats->rx_dropped = be32_to_cpu(mlx4_en_stats->RDROP) +
242 sw_rx_dropped; 244 sw_rx_dropped;
243 stats->rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength); 245 stats->rx_length_errors = be32_to_cpu(mlx4_en_stats->RdropLength);
244 stats->rx_over_errors = 0;
245 stats->rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC); 246 stats->rx_crc_errors = be32_to_cpu(mlx4_en_stats->RCRC);
246 stats->rx_frame_errors = 0;
247 stats->rx_fifo_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw); 247 stats->rx_fifo_errors = be32_to_cpu(mlx4_en_stats->RdropOvflw);
248 stats->rx_missed_errors = 0; 248 stats->tx_dropped += be32_to_cpu(mlx4_en_stats->TDROP);
249 stats->tx_aborted_errors = 0;
250 stats->tx_carrier_errors = 0;
251 stats->tx_fifo_errors = 0;
252 stats->tx_heartbeat_errors = 0;
253 stats->tx_window_errors = 0;
254 stats->tx_dropped = be32_to_cpu(mlx4_en_stats->TDROP);
255 249
256 /* RX stats */ 250 /* RX stats */
257 priv->pkstats.rx_multicast_packets = stats->multicast; 251 priv->pkstats.rx_multicast_packets = stats->multicast;
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
index f6e61570cb2c..76aa4d27183c 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -726,12 +726,12 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev)
726 bool inline_ok; 726 bool inline_ok;
727 u32 ring_cons; 727 u32 ring_cons;
728 728
729 if (!priv->port_up)
730 goto tx_drop;
731
732 tx_ind = skb_get_queue_mapping(skb); 729 tx_ind = skb_get_queue_mapping(skb);
733 ring = priv->tx_ring[tx_ind]; 730 ring = priv->tx_ring[tx_ind];
734 731
732 if (!priv->port_up)
733 goto tx_drop;
734
735 /* fetch ring->cons far ahead before needing it to avoid stall */ 735 /* fetch ring->cons far ahead before needing it to avoid stall */
736 ring_cons = ACCESS_ONCE(ring->cons); 736 ring_cons = ACCESS_ONCE(ring->cons);
737 737
@@ -1030,7 +1030,7 @@ tx_drop_unmap:
1030 1030
1031tx_drop: 1031tx_drop:
1032 dev_kfree_skb_any(skb); 1032 dev_kfree_skb_any(skb);
1033 priv->stats.tx_dropped++; 1033 ring->tx_dropped++;
1034 return NETDEV_TX_OK; 1034 return NETDEV_TX_OK;
1035} 1035}
1036 1036
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
index cc84e09f324a..467d47ed2c39 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
@@ -270,6 +270,7 @@ struct mlx4_en_tx_ring {
270 unsigned long tx_csum; 270 unsigned long tx_csum;
271 unsigned long tso_packets; 271 unsigned long tso_packets;
272 unsigned long xmit_more; 272 unsigned long xmit_more;
273 unsigned int tx_dropped;
273 struct mlx4_bf bf; 274 struct mlx4_bf bf;
274 unsigned long queue_stopped; 275 unsigned long queue_stopped;
275 276
@@ -482,8 +483,6 @@ struct mlx4_en_priv {
482 struct mlx4_en_port_profile *prof; 483 struct mlx4_en_port_profile *prof;
483 struct net_device *dev; 484 struct net_device *dev;
484 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; 485 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
485 struct net_device_stats stats;
486 struct net_device_stats ret_stats;
487 struct mlx4_en_port_state port_state; 486 struct mlx4_en_port_state port_state;
488 spinlock_t stats_lock; 487 spinlock_t stats_lock;
489 struct ethtool_flow_id ethtool_rules[MAX_NUM_OF_FS_RULES]; 488 struct ethtool_flow_id ethtool_rules[MAX_NUM_OF_FS_RULES];
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
index cbf58e1f9333..21ec1c2df2c7 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
@@ -192,9 +192,10 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
192 struct dcbx_app_priority_entry *p_tbl, 192 struct dcbx_app_priority_entry *p_tbl,
193 u32 pri_tc_tbl, int count, bool dcbx_enabled) 193 u32 pri_tc_tbl, int count, bool dcbx_enabled)
194{ 194{
195 u8 tc, priority, priority_map; 195 u8 tc, priority_map;
196 enum dcbx_protocol_type type; 196 enum dcbx_protocol_type type;
197 u16 protocol_id; 197 u16 protocol_id;
198 int priority;
198 bool enable; 199 bool enable;
199 int i; 200 int i;
200 201
@@ -221,7 +222,7 @@ qed_dcbx_process_tlv(struct qed_hwfn *p_hwfn,
221 * indication, but we only got here if there was an 222 * indication, but we only got here if there was an
222 * app tlv for the protocol, so dcbx must be enabled. 223 * app tlv for the protocol, so dcbx must be enabled.
223 */ 224 */
224 enable = !!(type == DCBX_PROTOCOL_ETH); 225 enable = !(type == DCBX_PROTOCOL_ETH);
225 226
226 qed_dcbx_update_app_info(p_data, p_hwfn, enable, true, 227 qed_dcbx_update_app_info(p_data, p_hwfn, enable, true,
227 priority, tc, type); 228 priority, tc, type);
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index 089016f46f26..2d89e8c16b32 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -155,12 +155,14 @@ void qed_resc_free(struct qed_dev *cdev)
155 } 155 }
156} 156}
157 157
158static int qed_init_qm_info(struct qed_hwfn *p_hwfn) 158static int qed_init_qm_info(struct qed_hwfn *p_hwfn, bool b_sleepable)
159{ 159{
160 u8 num_vports, vf_offset = 0, i, vport_id, num_ports, curr_queue = 0; 160 u8 num_vports, vf_offset = 0, i, vport_id, num_ports, curr_queue = 0;
161 struct qed_qm_info *qm_info = &p_hwfn->qm_info; 161 struct qed_qm_info *qm_info = &p_hwfn->qm_info;
162 struct init_qm_port_params *p_qm_port; 162 struct init_qm_port_params *p_qm_port;
163 u16 num_pqs, multi_cos_tcs = 1; 163 u16 num_pqs, multi_cos_tcs = 1;
164 u8 pf_wfq = qm_info->pf_wfq;
165 u32 pf_rl = qm_info->pf_rl;
164 u16 num_vfs = 0; 166 u16 num_vfs = 0;
165 167
166#ifdef CONFIG_QED_SRIOV 168#ifdef CONFIG_QED_SRIOV
@@ -182,23 +184,28 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
182 184
183 /* PQs will be arranged as follows: First per-TC PQ then pure-LB quete. 185 /* PQs will be arranged as follows: First per-TC PQ then pure-LB quete.
184 */ 186 */
185 qm_info->qm_pq_params = kzalloc(sizeof(*qm_info->qm_pq_params) * 187 qm_info->qm_pq_params = kcalloc(num_pqs,
186 num_pqs, GFP_KERNEL); 188 sizeof(struct init_qm_pq_params),
189 b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
187 if (!qm_info->qm_pq_params) 190 if (!qm_info->qm_pq_params)
188 goto alloc_err; 191 goto alloc_err;
189 192
190 qm_info->qm_vport_params = kzalloc(sizeof(*qm_info->qm_vport_params) * 193 qm_info->qm_vport_params = kcalloc(num_vports,
191 num_vports, GFP_KERNEL); 194 sizeof(struct init_qm_vport_params),
195 b_sleepable ? GFP_KERNEL
196 : GFP_ATOMIC);
192 if (!qm_info->qm_vport_params) 197 if (!qm_info->qm_vport_params)
193 goto alloc_err; 198 goto alloc_err;
194 199
195 qm_info->qm_port_params = kzalloc(sizeof(*qm_info->qm_port_params) * 200 qm_info->qm_port_params = kcalloc(MAX_NUM_PORTS,
196 MAX_NUM_PORTS, GFP_KERNEL); 201 sizeof(struct init_qm_port_params),
202 b_sleepable ? GFP_KERNEL
203 : GFP_ATOMIC);
197 if (!qm_info->qm_port_params) 204 if (!qm_info->qm_port_params)
198 goto alloc_err; 205 goto alloc_err;
199 206
200 qm_info->wfq_data = kcalloc(num_vports, sizeof(*qm_info->wfq_data), 207 qm_info->wfq_data = kcalloc(num_vports, sizeof(struct qed_wfq_data),
201 GFP_KERNEL); 208 b_sleepable ? GFP_KERNEL : GFP_ATOMIC);
202 if (!qm_info->wfq_data) 209 if (!qm_info->wfq_data)
203 goto alloc_err; 210 goto alloc_err;
204 211
@@ -264,10 +271,10 @@ static int qed_init_qm_info(struct qed_hwfn *p_hwfn)
264 for (i = 0; i < qm_info->num_vports; i++) 271 for (i = 0; i < qm_info->num_vports; i++)
265 qm_info->qm_vport_params[i].vport_wfq = 1; 272 qm_info->qm_vport_params[i].vport_wfq = 1;
266 273
267 qm_info->pf_wfq = 0;
268 qm_info->pf_rl = 0;
269 qm_info->vport_rl_en = 1; 274 qm_info->vport_rl_en = 1;
270 qm_info->vport_wfq_en = 1; 275 qm_info->vport_wfq_en = 1;
276 qm_info->pf_rl = pf_rl;
277 qm_info->pf_wfq = pf_wfq;
271 278
272 return 0; 279 return 0;
273 280
@@ -299,7 +306,7 @@ int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
299 qed_qm_info_free(p_hwfn); 306 qed_qm_info_free(p_hwfn);
300 307
301 /* initialize qed's qm data structure */ 308 /* initialize qed's qm data structure */
302 rc = qed_init_qm_info(p_hwfn); 309 rc = qed_init_qm_info(p_hwfn, false);
303 if (rc) 310 if (rc)
304 return rc; 311 return rc;
305 312
@@ -388,7 +395,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
388 goto alloc_err; 395 goto alloc_err;
389 396
390 /* Prepare and process QM requirements */ 397 /* Prepare and process QM requirements */
391 rc = qed_init_qm_info(p_hwfn); 398 rc = qed_init_qm_info(p_hwfn, true);
392 if (rc) 399 if (rc)
393 goto alloc_err; 400 goto alloc_err;
394 401
@@ -581,7 +588,14 @@ static void qed_calc_hw_mode(struct qed_hwfn *p_hwfn)
581 588
582 hw_mode |= 1 << MODE_ASIC; 589 hw_mode |= 1 << MODE_ASIC;
583 590
591 if (p_hwfn->cdev->num_hwfns > 1)
592 hw_mode |= 1 << MODE_100G;
593
584 p_hwfn->hw_info.hw_mode = hw_mode; 594 p_hwfn->hw_info.hw_mode = hw_mode;
595
596 DP_VERBOSE(p_hwfn, (NETIF_MSG_PROBE | NETIF_MSG_IFUP),
597 "Configuring function for hw_mode: 0x%08x\n",
598 p_hwfn->hw_info.hw_mode);
585} 599}
586 600
587/* Init run time data for all PFs on an engine. */ 601/* Init run time data for all PFs on an engine. */
@@ -821,6 +835,11 @@ int qed_hw_init(struct qed_dev *cdev,
821 u32 load_code, param; 835 u32 load_code, param;
822 int rc, mfw_rc, i; 836 int rc, mfw_rc, i;
823 837
838 if ((int_mode == QED_INT_MODE_MSI) && (cdev->num_hwfns > 1)) {
839 DP_NOTICE(cdev, "MSI mode is not supported for CMT devices\n");
840 return -EINVAL;
841 }
842
824 if (IS_PF(cdev)) { 843 if (IS_PF(cdev)) {
825 rc = qed_init_fw_data(cdev, bin_fw_data); 844 rc = qed_init_fw_data(cdev, bin_fw_data);
826 if (rc != 0) 845 if (rc != 0)
@@ -2086,6 +2105,13 @@ void qed_configure_vp_wfq_on_link_change(struct qed_dev *cdev, u32 min_pf_rate)
2086{ 2105{
2087 int i; 2106 int i;
2088 2107
2108 if (cdev->num_hwfns > 1) {
2109 DP_VERBOSE(cdev,
2110 NETIF_MSG_LINK,
2111 "WFQ configuration is not supported for this device\n");
2112 return;
2113 }
2114
2089 for_each_hwfn(cdev, i) { 2115 for_each_hwfn(cdev, i) {
2090 struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; 2116 struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
2091 2117
diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
index 8b22f87033ce..753064679bde 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
@@ -413,15 +413,17 @@ static int qed_set_int_mode(struct qed_dev *cdev, bool force_mode)
413 /* Fallthrough */ 413 /* Fallthrough */
414 414
415 case QED_INT_MODE_MSI: 415 case QED_INT_MODE_MSI:
416 rc = pci_enable_msi(cdev->pdev); 416 if (cdev->num_hwfns == 1) {
417 if (!rc) { 417 rc = pci_enable_msi(cdev->pdev);
418 int_params->out.int_mode = QED_INT_MODE_MSI; 418 if (!rc) {
419 goto out; 419 int_params->out.int_mode = QED_INT_MODE_MSI;
420 } 420 goto out;
421 }
421 422
422 DP_NOTICE(cdev, "Failed to enable MSI\n"); 423 DP_NOTICE(cdev, "Failed to enable MSI\n");
423 if (force_mode) 424 if (force_mode)
424 goto out; 425 goto out;
426 }
425 /* Fallthrough */ 427 /* Fallthrough */
426 428
427 case QED_INT_MODE_INTA: 429 case QED_INT_MODE_INTA:
diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
index 1bc75358cbc4..ad3cae3b7243 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c
@@ -230,7 +230,10 @@ static int qede_get_sset_count(struct net_device *dev, int stringset)
230 case ETH_SS_PRIV_FLAGS: 230 case ETH_SS_PRIV_FLAGS:
231 return QEDE_PRI_FLAG_LEN; 231 return QEDE_PRI_FLAG_LEN;
232 case ETH_SS_TEST: 232 case ETH_SS_TEST:
233 return QEDE_ETHTOOL_TEST_MAX; 233 if (!IS_VF(edev))
234 return QEDE_ETHTOOL_TEST_MAX;
235 else
236 return 0;
234 default: 237 default:
235 DP_VERBOSE(edev, QED_MSG_DEBUG, 238 DP_VERBOSE(edev, QED_MSG_DEBUG,
236 "Unsupported stringset 0x%08x\n", stringset); 239 "Unsupported stringset 0x%08x\n", stringset);
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 337e839ca586..5d00d1404bfc 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1824,7 +1824,7 @@ static int qede_set_vf_rate(struct net_device *dev, int vfidx,
1824{ 1824{
1825 struct qede_dev *edev = netdev_priv(dev); 1825 struct qede_dev *edev = netdev_priv(dev);
1826 1826
1827 return edev->ops->iov->set_rate(edev->cdev, vfidx, max_tx_rate, 1827 return edev->ops->iov->set_rate(edev->cdev, vfidx, min_tx_rate,
1828 max_tx_rate); 1828 max_tx_rate);
1829} 1829}
1830 1830
@@ -2091,6 +2091,29 @@ static void qede_vlan_mark_nonconfigured(struct qede_dev *edev)
2091 edev->accept_any_vlan = false; 2091 edev->accept_any_vlan = false;
2092} 2092}
2093 2093
2094int qede_set_features(struct net_device *dev, netdev_features_t features)
2095{
2096 struct qede_dev *edev = netdev_priv(dev);
2097 netdev_features_t changes = features ^ dev->features;
2098 bool need_reload = false;
2099
2100 /* No action needed if hardware GRO is disabled during driver load */
2101 if (changes & NETIF_F_GRO) {
2102 if (dev->features & NETIF_F_GRO)
2103 need_reload = !edev->gro_disable;
2104 else
2105 need_reload = edev->gro_disable;
2106 }
2107
2108 if (need_reload && netif_running(edev->ndev)) {
2109 dev->features = features;
2110 qede_reload(edev, NULL, NULL);
2111 return 1;
2112 }
2113
2114 return 0;
2115}
2116
2094#ifdef CONFIG_QEDE_VXLAN 2117#ifdef CONFIG_QEDE_VXLAN
2095static void qede_add_vxlan_port(struct net_device *dev, 2118static void qede_add_vxlan_port(struct net_device *dev,
2096 sa_family_t sa_family, __be16 port) 2119 sa_family_t sa_family, __be16 port)
@@ -2175,6 +2198,7 @@ static const struct net_device_ops qede_netdev_ops = {
2175#endif 2198#endif
2176 .ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid, 2199 .ndo_vlan_rx_add_vid = qede_vlan_rx_add_vid,
2177 .ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid, 2200 .ndo_vlan_rx_kill_vid = qede_vlan_rx_kill_vid,
2201 .ndo_set_features = qede_set_features,
2178 .ndo_get_stats64 = qede_get_stats64, 2202 .ndo_get_stats64 = qede_get_stats64,
2179#ifdef CONFIG_QED_SRIOV 2203#ifdef CONFIG_QED_SRIOV
2180 .ndo_set_vf_link_state = qede_set_vf_link_state, 2204 .ndo_set_vf_link_state = qede_set_vf_link_state,
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 83d72106471c..fd5d1c93b55b 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4846,7 +4846,6 @@ static void ql_eeh_close(struct net_device *ndev)
4846 } 4846 }
4847 4847
4848 /* Disabling the timer */ 4848 /* Disabling the timer */
4849 del_timer_sync(&qdev->timer);
4850 ql_cancel_all_work_sync(qdev); 4849 ql_cancel_all_work_sync(qdev);
4851 4850
4852 for (i = 0; i < qdev->rss_ring_count; i++) 4851 for (i = 0; i < qdev->rss_ring_count; i++)
@@ -4873,6 +4872,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
4873 return PCI_ERS_RESULT_CAN_RECOVER; 4872 return PCI_ERS_RESULT_CAN_RECOVER;
4874 case pci_channel_io_frozen: 4873 case pci_channel_io_frozen:
4875 netif_device_detach(ndev); 4874 netif_device_detach(ndev);
4875 del_timer_sync(&qdev->timer);
4876 if (netif_running(ndev)) 4876 if (netif_running(ndev))
4877 ql_eeh_close(ndev); 4877 ql_eeh_close(ndev);
4878 pci_disable_device(pdev); 4878 pci_disable_device(pdev);
@@ -4880,6 +4880,7 @@ static pci_ers_result_t qlge_io_error_detected(struct pci_dev *pdev,
4880 case pci_channel_io_perm_failure: 4880 case pci_channel_io_perm_failure:
4881 dev_err(&pdev->dev, 4881 dev_err(&pdev->dev,
4882 "%s: pci_channel_io_perm_failure.\n", __func__); 4882 "%s: pci_channel_io_perm_failure.\n", __func__);
4883 del_timer_sync(&qdev->timer);
4883 ql_eeh_close(ndev); 4884 ql_eeh_close(ndev);
4884 set_bit(QL_EEH_FATAL, &qdev->flags); 4885 set_bit(QL_EEH_FATAL, &qdev->flags);
4885 return PCI_ERS_RESULT_DISCONNECT; 4886 return PCI_ERS_RESULT_DISCONNECT;
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 1681084cc96f..1f309127457d 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -619,6 +619,17 @@ fail:
619 return rc; 619 return rc;
620} 620}
621 621
622static void efx_ef10_forget_old_piobufs(struct efx_nic *efx)
623{
624 struct efx_channel *channel;
625 struct efx_tx_queue *tx_queue;
626
627 /* All our existing PIO buffers went away */
628 efx_for_each_channel(channel, efx)
629 efx_for_each_channel_tx_queue(tx_queue, channel)
630 tx_queue->piobuf = NULL;
631}
632
622#else /* !EFX_USE_PIO */ 633#else /* !EFX_USE_PIO */
623 634
624static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n) 635static int efx_ef10_alloc_piobufs(struct efx_nic *efx, unsigned int n)
@@ -635,6 +646,10 @@ static void efx_ef10_free_piobufs(struct efx_nic *efx)
635{ 646{
636} 647}
637 648
649static void efx_ef10_forget_old_piobufs(struct efx_nic *efx)
650{
651}
652
638#endif /* EFX_USE_PIO */ 653#endif /* EFX_USE_PIO */
639 654
640static void efx_ef10_remove(struct efx_nic *efx) 655static void efx_ef10_remove(struct efx_nic *efx)
@@ -1018,6 +1033,7 @@ static void efx_ef10_reset_mc_allocations(struct efx_nic *efx)
1018 nic_data->must_realloc_vis = true; 1033 nic_data->must_realloc_vis = true;
1019 nic_data->must_restore_filters = true; 1034 nic_data->must_restore_filters = true;
1020 nic_data->must_restore_piobufs = true; 1035 nic_data->must_restore_piobufs = true;
1036 efx_ef10_forget_old_piobufs(efx);
1021 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID; 1037 nic_data->rx_rss_context = EFX_EF10_RSS_CONTEXT_INVALID;
1022 1038
1023 /* Driver-created vswitches and vports must be re-created */ 1039 /* Driver-created vswitches and vports must be re-created */
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index 0705ec869487..097f363f1630 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -1726,14 +1726,33 @@ static int efx_probe_filters(struct efx_nic *efx)
1726 1726
1727#ifdef CONFIG_RFS_ACCEL 1727#ifdef CONFIG_RFS_ACCEL
1728 if (efx->type->offload_features & NETIF_F_NTUPLE) { 1728 if (efx->type->offload_features & NETIF_F_NTUPLE) {
1729 efx->rps_flow_id = kcalloc(efx->type->max_rx_ip_filters, 1729 struct efx_channel *channel;
1730 sizeof(*efx->rps_flow_id), 1730 int i, success = 1;
1731 GFP_KERNEL); 1731
1732 if (!efx->rps_flow_id) { 1732 efx_for_each_channel(channel, efx) {
1733 channel->rps_flow_id =
1734 kcalloc(efx->type->max_rx_ip_filters,
1735 sizeof(*channel->rps_flow_id),
1736 GFP_KERNEL);
1737 if (!channel->rps_flow_id)
1738 success = 0;
1739 else
1740 for (i = 0;
1741 i < efx->type->max_rx_ip_filters;
1742 ++i)
1743 channel->rps_flow_id[i] =
1744 RPS_FLOW_ID_INVALID;
1745 }
1746
1747 if (!success) {
1748 efx_for_each_channel(channel, efx)
1749 kfree(channel->rps_flow_id);
1733 efx->type->filter_table_remove(efx); 1750 efx->type->filter_table_remove(efx);
1734 rc = -ENOMEM; 1751 rc = -ENOMEM;
1735 goto out_unlock; 1752 goto out_unlock;
1736 } 1753 }
1754
1755 efx->rps_expire_index = efx->rps_expire_channel = 0;
1737 } 1756 }
1738#endif 1757#endif
1739out_unlock: 1758out_unlock:
@@ -1744,7 +1763,10 @@ out_unlock:
1744static void efx_remove_filters(struct efx_nic *efx) 1763static void efx_remove_filters(struct efx_nic *efx)
1745{ 1764{
1746#ifdef CONFIG_RFS_ACCEL 1765#ifdef CONFIG_RFS_ACCEL
1747 kfree(efx->rps_flow_id); 1766 struct efx_channel *channel;
1767
1768 efx_for_each_channel(channel, efx)
1769 kfree(channel->rps_flow_id);
1748#endif 1770#endif
1749 down_write(&efx->filter_sem); 1771 down_write(&efx->filter_sem);
1750 efx->type->filter_table_remove(efx); 1772 efx->type->filter_table_remove(efx);
diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
index 38c422321cda..d13ddf9703ff 100644
--- a/drivers/net/ethernet/sfc/net_driver.h
+++ b/drivers/net/ethernet/sfc/net_driver.h
@@ -403,6 +403,8 @@ enum efx_sync_events_state {
403 * @event_test_cpu: Last CPU to handle interrupt or test event for this channel 403 * @event_test_cpu: Last CPU to handle interrupt or test event for this channel
404 * @irq_count: Number of IRQs since last adaptive moderation decision 404 * @irq_count: Number of IRQs since last adaptive moderation decision
405 * @irq_mod_score: IRQ moderation score 405 * @irq_mod_score: IRQ moderation score
406 * @rps_flow_id: Flow IDs of filters allocated for accelerated RFS,
407 * indexed by filter ID
406 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors 408 * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors
407 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors 409 * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors
408 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors 410 * @n_rx_tcp_udp_chksum_err: Count of RX TCP and UDP checksum errors
@@ -446,6 +448,8 @@ struct efx_channel {
446 unsigned int irq_mod_score; 448 unsigned int irq_mod_score;
447#ifdef CONFIG_RFS_ACCEL 449#ifdef CONFIG_RFS_ACCEL
448 unsigned int rfs_filters_added; 450 unsigned int rfs_filters_added;
451#define RPS_FLOW_ID_INVALID 0xFFFFFFFF
452 u32 *rps_flow_id;
449#endif 453#endif
450 454
451 unsigned n_rx_tobe_disc; 455 unsigned n_rx_tobe_disc;
@@ -889,9 +893,9 @@ struct vfdi_status;
889 * @filter_sem: Filter table rw_semaphore, for freeing the table 893 * @filter_sem: Filter table rw_semaphore, for freeing the table
890 * @filter_lock: Filter table lock, for mere content changes 894 * @filter_lock: Filter table lock, for mere content changes
891 * @filter_state: Architecture-dependent filter table state 895 * @filter_state: Architecture-dependent filter table state
892 * @rps_flow_id: Flow IDs of filters allocated for accelerated RFS, 896 * @rps_expire_channel: Next channel to check for expiry
893 * indexed by filter ID 897 * @rps_expire_index: Next index to check for expiry in
894 * @rps_expire_index: Next index to check for expiry in @rps_flow_id 898 * @rps_expire_channel's @rps_flow_id
895 * @active_queues: Count of RX and TX queues that haven't been flushed and drained. 899 * @active_queues: Count of RX and TX queues that haven't been flushed and drained.
896 * @rxq_flush_pending: Count of number of receive queues that need to be flushed. 900 * @rxq_flush_pending: Count of number of receive queues that need to be flushed.
897 * Decremented when the efx_flush_rx_queue() is called. 901 * Decremented when the efx_flush_rx_queue() is called.
@@ -1035,7 +1039,7 @@ struct efx_nic {
1035 spinlock_t filter_lock; 1039 spinlock_t filter_lock;
1036 void *filter_state; 1040 void *filter_state;
1037#ifdef CONFIG_RFS_ACCEL 1041#ifdef CONFIG_RFS_ACCEL
1038 u32 *rps_flow_id; 1042 unsigned int rps_expire_channel;
1039 unsigned int rps_expire_index; 1043 unsigned int rps_expire_index;
1040#endif 1044#endif
1041 1045
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 8956995b2fe7..02b0b5272c14 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -842,33 +842,18 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
842 struct efx_nic *efx = netdev_priv(net_dev); 842 struct efx_nic *efx = netdev_priv(net_dev);
843 struct efx_channel *channel; 843 struct efx_channel *channel;
844 struct efx_filter_spec spec; 844 struct efx_filter_spec spec;
845 const __be16 *ports; 845 struct flow_keys fk;
846 __be16 ether_type;
847 int nhoff;
848 int rc; 846 int rc;
849 847
850 /* The core RPS/RFS code has already parsed and validated 848 if (flow_id == RPS_FLOW_ID_INVALID)
851 * VLAN, IP and transport headers. We assume they are in the 849 return -EINVAL;
852 * header area.
853 */
854
855 if (skb->protocol == htons(ETH_P_8021Q)) {
856 const struct vlan_hdr *vh =
857 (const struct vlan_hdr *)skb->data;
858 850
859 /* We can't filter on the IP 5-tuple and the vlan 851 if (!skb_flow_dissect_flow_keys(skb, &fk, 0))
860 * together, so just strip the vlan header and filter 852 return -EPROTONOSUPPORT;
861 * on the IP part.
862 */
863 EFX_BUG_ON_PARANOID(skb_headlen(skb) < sizeof(*vh));
864 ether_type = vh->h_vlan_encapsulated_proto;
865 nhoff = sizeof(struct vlan_hdr);
866 } else {
867 ether_type = skb->protocol;
868 nhoff = 0;
869 }
870 853
871 if (ether_type != htons(ETH_P_IP) && ether_type != htons(ETH_P_IPV6)) 854 if (fk.basic.n_proto != htons(ETH_P_IP) && fk.basic.n_proto != htons(ETH_P_IPV6))
855 return -EPROTONOSUPPORT;
856 if (fk.control.flags & FLOW_DIS_IS_FRAGMENT)
872 return -EPROTONOSUPPORT; 857 return -EPROTONOSUPPORT;
873 858
874 efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 859 efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT,
@@ -878,56 +863,41 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
878 EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO | 863 EFX_FILTER_MATCH_ETHER_TYPE | EFX_FILTER_MATCH_IP_PROTO |
879 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT | 864 EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT |
880 EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT; 865 EFX_FILTER_MATCH_REM_HOST | EFX_FILTER_MATCH_REM_PORT;
881 spec.ether_type = ether_type; 866 spec.ether_type = fk.basic.n_proto;
882 867 spec.ip_proto = fk.basic.ip_proto;
883 if (ether_type == htons(ETH_P_IP)) { 868
884 const struct iphdr *ip = 869 if (fk.basic.n_proto == htons(ETH_P_IP)) {
885 (const struct iphdr *)(skb->data + nhoff); 870 spec.rem_host[0] = fk.addrs.v4addrs.src;
886 871 spec.loc_host[0] = fk.addrs.v4addrs.dst;
887 EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + sizeof(*ip));
888 if (ip_is_fragment(ip))
889 return -EPROTONOSUPPORT;
890 spec.ip_proto = ip->protocol;
891 spec.rem_host[0] = ip->saddr;
892 spec.loc_host[0] = ip->daddr;
893 EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4);
894 ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl);
895 } else { 872 } else {
896 const struct ipv6hdr *ip6 = 873 memcpy(spec.rem_host, &fk.addrs.v6addrs.src, sizeof(struct in6_addr));
897 (const struct ipv6hdr *)(skb->data + nhoff); 874 memcpy(spec.loc_host, &fk.addrs.v6addrs.dst, sizeof(struct in6_addr));
898
899 EFX_BUG_ON_PARANOID(skb_headlen(skb) <
900 nhoff + sizeof(*ip6) + 4);
901 spec.ip_proto = ip6->nexthdr;
902 memcpy(spec.rem_host, &ip6->saddr, sizeof(ip6->saddr));
903 memcpy(spec.loc_host, &ip6->daddr, sizeof(ip6->daddr));
904 ports = (const __be16 *)(ip6 + 1);
905 } 875 }
906 876
907 spec.rem_port = ports[0]; 877 spec.rem_port = fk.ports.src;
908 spec.loc_port = ports[1]; 878 spec.loc_port = fk.ports.dst;
909 879
910 rc = efx->type->filter_rfs_insert(efx, &spec); 880 rc = efx->type->filter_rfs_insert(efx, &spec);
911 if (rc < 0) 881 if (rc < 0)
912 return rc; 882 return rc;
913 883
914 /* Remember this so we can check whether to expire the filter later */ 884 /* Remember this so we can check whether to expire the filter later */
915 efx->rps_flow_id[rc] = flow_id; 885 channel = efx_get_channel(efx, rxq_index);
916 channel = efx_get_channel(efx, skb_get_rx_queue(skb)); 886 channel->rps_flow_id[rc] = flow_id;
917 ++channel->rfs_filters_added; 887 ++channel->rfs_filters_added;
918 888
919 if (ether_type == htons(ETH_P_IP)) 889 if (spec.ether_type == htons(ETH_P_IP))
920 netif_info(efx, rx_status, efx->net_dev, 890 netif_info(efx, rx_status, efx->net_dev,
921 "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n", 891 "steering %s %pI4:%u:%pI4:%u to queue %u [flow %u filter %d]\n",
922 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", 892 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP",
923 spec.rem_host, ntohs(ports[0]), spec.loc_host, 893 spec.rem_host, ntohs(spec.rem_port), spec.loc_host,
924 ntohs(ports[1]), rxq_index, flow_id, rc); 894 ntohs(spec.loc_port), rxq_index, flow_id, rc);
925 else 895 else
926 netif_info(efx, rx_status, efx->net_dev, 896 netif_info(efx, rx_status, efx->net_dev,
927 "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n", 897 "steering %s [%pI6]:%u:[%pI6]:%u to queue %u [flow %u filter %d]\n",
928 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP", 898 (spec.ip_proto == IPPROTO_TCP) ? "TCP" : "UDP",
929 spec.rem_host, ntohs(ports[0]), spec.loc_host, 899 spec.rem_host, ntohs(spec.rem_port), spec.loc_host,
930 ntohs(ports[1]), rxq_index, flow_id, rc); 900 ntohs(spec.loc_port), rxq_index, flow_id, rc);
931 901
932 return rc; 902 return rc;
933} 903}
@@ -935,24 +905,34 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
935bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned int quota) 905bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned int quota)
936{ 906{
937 bool (*expire_one)(struct efx_nic *efx, u32 flow_id, unsigned int index); 907 bool (*expire_one)(struct efx_nic *efx, u32 flow_id, unsigned int index);
938 unsigned int index, size; 908 unsigned int channel_idx, index, size;
939 u32 flow_id; 909 u32 flow_id;
940 910
941 if (!spin_trylock_bh(&efx->filter_lock)) 911 if (!spin_trylock_bh(&efx->filter_lock))
942 return false; 912 return false;
943 913
944 expire_one = efx->type->filter_rfs_expire_one; 914 expire_one = efx->type->filter_rfs_expire_one;
915 channel_idx = efx->rps_expire_channel;
945 index = efx->rps_expire_index; 916 index = efx->rps_expire_index;
946 size = efx->type->max_rx_ip_filters; 917 size = efx->type->max_rx_ip_filters;
947 while (quota--) { 918 while (quota--) {
948 flow_id = efx->rps_flow_id[index]; 919 struct efx_channel *channel = efx_get_channel(efx, channel_idx);
949 if (expire_one(efx, flow_id, index)) 920 flow_id = channel->rps_flow_id[index];
921
922 if (flow_id != RPS_FLOW_ID_INVALID &&
923 expire_one(efx, flow_id, index)) {
950 netif_info(efx, rx_status, efx->net_dev, 924 netif_info(efx, rx_status, efx->net_dev,
951 "expired filter %d [flow %u]\n", 925 "expired filter %d [queue %u flow %u]\n",
952 index, flow_id); 926 index, channel_idx, flow_id);
953 if (++index == size) 927 channel->rps_flow_id[index] = RPS_FLOW_ID_INVALID;
928 }
929 if (++index == size) {
930 if (++channel_idx == efx->n_channels)
931 channel_idx = 0;
954 index = 0; 932 index = 0;
933 }
955 } 934 }
935 efx->rps_expire_channel = channel_idx;
956 efx->rps_expire_index = index; 936 efx->rps_expire_index = index;
957 937
958 spin_unlock_bh(&efx->filter_lock); 938 spin_unlock_bh(&efx->filter_lock);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index 3f83c369f56c..ec295851812b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -297,7 +297,7 @@ int stmmac_mdio_register(struct net_device *ndev)
297 return -ENOMEM; 297 return -ENOMEM;
298 298
299 if (mdio_bus_data->irqs) 299 if (mdio_bus_data->irqs)
300 memcpy(new_bus->irq, mdio_bus_data, sizeof(new_bus->irq)); 300 memcpy(new_bus->irq, mdio_bus_data->irqs, sizeof(new_bus->irq));
301 301
302#ifdef CONFIG_OF 302#ifdef CONFIG_OF
303 if (priv->device->of_node) 303 if (priv->device->of_node)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index a0f64cba86ba..2ace126533cd 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -990,7 +990,7 @@ static void team_port_disable(struct team *team,
990#define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \ 990#define TEAM_ENC_FEATURES (NETIF_F_HW_CSUM | NETIF_F_SG | \
991 NETIF_F_RXCSUM | NETIF_F_ALL_TSO) 991 NETIF_F_RXCSUM | NETIF_F_ALL_TSO)
992 992
993static void __team_compute_features(struct team *team) 993static void ___team_compute_features(struct team *team)
994{ 994{
995 struct team_port *port; 995 struct team_port *port;
996 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL; 996 u32 vlan_features = TEAM_VLAN_FEATURES & NETIF_F_ALL_FOR_ALL;
@@ -1021,15 +1021,20 @@ static void __team_compute_features(struct team *team)
1021 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1021 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1022 if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM)) 1022 if (dst_release_flag == (IFF_XMIT_DST_RELEASE | IFF_XMIT_DST_RELEASE_PERM))
1023 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; 1023 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE;
1024}
1024 1025
1026static void __team_compute_features(struct team *team)
1027{
1028 ___team_compute_features(team);
1025 netdev_change_features(team->dev); 1029 netdev_change_features(team->dev);
1026} 1030}
1027 1031
1028static void team_compute_features(struct team *team) 1032static void team_compute_features(struct team *team)
1029{ 1033{
1030 mutex_lock(&team->lock); 1034 mutex_lock(&team->lock);
1031 __team_compute_features(team); 1035 ___team_compute_features(team);
1032 mutex_unlock(&team->lock); 1036 mutex_unlock(&team->lock);
1037 netdev_change_features(team->dev);
1033} 1038}
1034 1039
1035static int team_port_enter(struct team *team, struct team_port *port) 1040static int team_port_enter(struct team *team, struct team_port *port)
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 36cd7f016a8d..9bbe0161a2f4 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -473,7 +473,7 @@ static void read_bulk_callback(struct urb *urb)
473 goto goon; 473 goto goon;
474 } 474 }
475 475
476 if (!count || count < 4) 476 if (count < 4)
477 goto goon; 477 goto goon;
478 478
479 rx_status = buf[count - 2]; 479 rx_status = buf[count - 2];
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index d9d2806a47b1..dc989a8b5afb 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -61,6 +61,8 @@
61#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ 61#define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \
62 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) 62 SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3)
63 63
64#define CARRIER_CHECK_DELAY (2 * HZ)
65
64struct smsc95xx_priv { 66struct smsc95xx_priv {
65 u32 mac_cr; 67 u32 mac_cr;
66 u32 hash_hi; 68 u32 hash_hi;
@@ -69,6 +71,9 @@ struct smsc95xx_priv {
69 spinlock_t mac_cr_lock; 71 spinlock_t mac_cr_lock;
70 u8 features; 72 u8 features;
71 u8 suspend_flags; 73 u8 suspend_flags;
74 bool link_ok;
75 struct delayed_work carrier_check;
76 struct usbnet *dev;
72}; 77};
73 78
74static bool turbo_mode = true; 79static bool turbo_mode = true;
@@ -624,6 +629,44 @@ static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
624 intdata); 629 intdata);
625} 630}
626 631
632static void set_carrier(struct usbnet *dev, bool link)
633{
634 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
635
636 if (pdata->link_ok == link)
637 return;
638
639 pdata->link_ok = link;
640
641 if (link)
642 usbnet_link_change(dev, 1, 0);
643 else
644 usbnet_link_change(dev, 0, 0);
645}
646
647static void check_carrier(struct work_struct *work)
648{
649 struct smsc95xx_priv *pdata = container_of(work, struct smsc95xx_priv,
650 carrier_check.work);
651 struct usbnet *dev = pdata->dev;
652 int ret;
653
654 if (pdata->suspend_flags != 0)
655 return;
656
657 ret = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMSR);
658 if (ret < 0) {
659 netdev_warn(dev->net, "Failed to read MII_BMSR\n");
660 return;
661 }
662 if (ret & BMSR_LSTATUS)
663 set_carrier(dev, 1);
664 else
665 set_carrier(dev, 0);
666
667 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
668}
669
627/* Enable or disable Tx & Rx checksum offload engines */ 670/* Enable or disable Tx & Rx checksum offload engines */
628static int smsc95xx_set_features(struct net_device *netdev, 671static int smsc95xx_set_features(struct net_device *netdev,
629 netdev_features_t features) 672 netdev_features_t features)
@@ -1165,13 +1208,20 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1165 dev->net->flags |= IFF_MULTICAST; 1208 dev->net->flags |= IFF_MULTICAST;
1166 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; 1209 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
1167 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; 1210 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
1211
1212 pdata->dev = dev;
1213 INIT_DELAYED_WORK(&pdata->carrier_check, check_carrier);
1214 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
1215
1168 return 0; 1216 return 0;
1169} 1217}
1170 1218
1171static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf) 1219static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1172{ 1220{
1173 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 1221 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1222
1174 if (pdata) { 1223 if (pdata) {
1224 cancel_delayed_work(&pdata->carrier_check);
1175 netif_dbg(dev, ifdown, dev->net, "free pdata\n"); 1225 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
1176 kfree(pdata); 1226 kfree(pdata);
1177 pdata = NULL; 1227 pdata = NULL;
@@ -1695,6 +1745,7 @@ static int smsc95xx_resume(struct usb_interface *intf)
1695 1745
1696 /* do this first to ensure it's cleared even in error case */ 1746 /* do this first to ensure it's cleared even in error case */
1697 pdata->suspend_flags = 0; 1747 pdata->suspend_flags = 0;
1748 schedule_delayed_work(&pdata->carrier_check, CARRIER_CHECK_DELAY);
1698 1749
1699 if (suspend_flags & SUSPEND_ALLMODES) { 1750 if (suspend_flags & SUSPEND_ALLMODES) {
1700 /* clear wake-up sources */ 1751 /* clear wake-up sources */
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 49d84e540343..e0638e556fe7 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -1925,24 +1925,11 @@ static int virtnet_probe(struct virtio_device *vdev)
1925 1925
1926 virtio_device_ready(vdev); 1926 virtio_device_ready(vdev);
1927 1927
1928 /* Last of all, set up some receive buffers. */
1929 for (i = 0; i < vi->curr_queue_pairs; i++) {
1930 try_fill_recv(vi, &vi->rq[i], GFP_KERNEL);
1931
1932 /* If we didn't even get one input buffer, we're useless. */
1933 if (vi->rq[i].vq->num_free ==
1934 virtqueue_get_vring_size(vi->rq[i].vq)) {
1935 free_unused_bufs(vi);
1936 err = -ENOMEM;
1937 goto free_recv_bufs;
1938 }
1939 }
1940
1941 vi->nb.notifier_call = &virtnet_cpu_callback; 1928 vi->nb.notifier_call = &virtnet_cpu_callback;
1942 err = register_hotcpu_notifier(&vi->nb); 1929 err = register_hotcpu_notifier(&vi->nb);
1943 if (err) { 1930 if (err) {
1944 pr_debug("virtio_net: registering cpu notifier failed\n"); 1931 pr_debug("virtio_net: registering cpu notifier failed\n");
1945 goto free_recv_bufs; 1932 goto free_unregister_netdev;
1946 } 1933 }
1947 1934
1948 /* Assume link up if device can't report link status, 1935 /* Assume link up if device can't report link status,
@@ -1960,10 +1947,9 @@ static int virtnet_probe(struct virtio_device *vdev)
1960 1947
1961 return 0; 1948 return 0;
1962 1949
1963free_recv_bufs: 1950free_unregister_netdev:
1964 vi->vdev->config->reset(vdev); 1951 vi->vdev->config->reset(vdev);
1965 1952
1966 free_receive_bufs(vi);
1967 unregister_netdev(dev); 1953 unregister_netdev(dev);
1968free_vqs: 1954free_vqs:
1969 cancel_delayed_work_sync(&vi->refill); 1955 cancel_delayed_work_sync(&vi->refill);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8ff30c3bdfce..f999db2f97b4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3086,6 +3086,9 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
3086 if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL]) 3086 if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL])
3087 conf.flags |= VXLAN_F_REMCSUM_NOPARTIAL; 3087 conf.flags |= VXLAN_F_REMCSUM_NOPARTIAL;
3088 3088
3089 if (tb[IFLA_MTU])
3090 conf.mtu = nla_get_u32(tb[IFLA_MTU]);
3091
3089 err = vxlan_dev_configure(src_net, dev, &conf); 3092 err = vxlan_dev_configure(src_net, dev, &conf);
3090 switch (err) { 3093 switch (err) {
3091 case -ENODEV: 3094 case -ENODEV:
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index f2d01d4d9364..1b8304e1efaa 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -950,17 +950,14 @@ static int of_pmu_irq_cfg(struct arm_pmu *pmu)
950 950
951 /* For SPIs, we need to track the affinity per IRQ */ 951 /* For SPIs, we need to track the affinity per IRQ */
952 if (using_spi) { 952 if (using_spi) {
953 if (i >= pdev->num_resources) { 953 if (i >= pdev->num_resources)
954 of_node_put(dn);
955 break; 954 break;
956 }
957 955
958 irqs[i] = cpu; 956 irqs[i] = cpu;
959 } 957 }
960 958
961 /* Keep track of the CPUs containing this PMU type */ 959 /* Keep track of the CPUs containing this PMU type */
962 cpumask_set_cpu(cpu, &pmu->supported_cpus); 960 cpumask_set_cpu(cpu, &pmu->supported_cpus);
963 of_node_put(dn);
964 i++; 961 i++;
965 } while (1); 962 } while (1);
966 963
@@ -995,9 +992,6 @@ int arm_pmu_device_probe(struct platform_device *pdev,
995 992
996 armpmu_init(pmu); 993 armpmu_init(pmu);
997 994
998 if (!__oprofile_cpu_pmu)
999 __oprofile_cpu_pmu = pmu;
1000
1001 pmu->plat_device = pdev; 995 pmu->plat_device = pdev;
1002 996
1003 if (node && (of_id = of_match_node(of_table, pdev->dev.of_node))) { 997 if (node && (of_id = of_match_node(of_table, pdev->dev.of_node))) {
@@ -1033,6 +1027,9 @@ int arm_pmu_device_probe(struct platform_device *pdev,
1033 if (ret) 1027 if (ret)
1034 goto out_destroy; 1028 goto out_destroy;
1035 1029
1030 if (!__oprofile_cpu_pmu)
1031 __oprofile_cpu_pmu = pmu;
1032
1036 pr_info("enabled with %s PMU driver, %d counters available\n", 1033 pr_info("enabled with %s PMU driver, %d counters available\n",
1037 pmu->name, pmu->num_events); 1034 pmu->name, pmu->num_events);
1038 1035
@@ -1043,6 +1040,7 @@ out_destroy:
1043out_free: 1040out_free:
1044 pr_info("%s: failed to register PMU devices!\n", 1041 pr_info("%s: failed to register PMU devices!\n",
1045 of_node_full_name(node)); 1042 of_node_full_name(node));
1043 kfree(pmu->irq_affinity);
1046 kfree(pmu); 1044 kfree(pmu);
1047 return ret; 1045 return ret;
1048} 1046}
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 207b13b618cf..a607655d7830 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1256,9 +1256,10 @@ static void mtk_eint_irq_handler(struct irq_desc *desc)
1256 const struct mtk_desc_pin *pin; 1256 const struct mtk_desc_pin *pin;
1257 1257
1258 chained_irq_enter(chip, desc); 1258 chained_irq_enter(chip, desc);
1259 for (eint_num = 0; eint_num < pctl->devdata->ap_num; eint_num += 32) { 1259 for (eint_num = 0;
1260 eint_num < pctl->devdata->ap_num;
1261 eint_num += 32, reg += 4) {
1260 status = readl(reg); 1262 status = readl(reg);
1261 reg += 4;
1262 while (status) { 1263 while (status) {
1263 offset = __ffs(status); 1264 offset = __ffs(status);
1264 index = eint_num + offset; 1265 index = eint_num + offset;
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index ccbfc325c778..38faceff2f08 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -854,7 +854,7 @@ static int nmk_gpio_get_dir(struct gpio_chip *chip, unsigned offset)
854 854
855 clk_enable(nmk_chip->clk); 855 clk_enable(nmk_chip->clk);
856 856
857 dir = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset)); 857 dir = !(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset));
858 858
859 clk_disable(nmk_chip->clk); 859 clk_disable(nmk_chip->clk);
860 860
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 579fd65299a0..d637c933c8a9 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -208,14 +208,10 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
208 break; 208 break;
209 209
210 case PTP_SYS_OFFSET: 210 case PTP_SYS_OFFSET:
211 sysoff = kmalloc(sizeof(*sysoff), GFP_KERNEL); 211 sysoff = memdup_user((void __user *)arg, sizeof(*sysoff));
212 if (!sysoff) { 212 if (IS_ERR(sysoff)) {
213 err = -ENOMEM; 213 err = PTR_ERR(sysoff);
214 break; 214 sysoff = NULL;
215 }
216 if (copy_from_user(sysoff, (void __user *)arg,
217 sizeof(*sysoff))) {
218 err = -EFAULT;
219 break; 215 break;
220 } 216 }
221 if (sysoff->n_samples > PTP_MAX_SAMPLES) { 217 if (sysoff->n_samples > PTP_MAX_SAMPLES) {
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 8f90d9e77104..969c312de1be 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -621,6 +621,11 @@ struct aac_driver_ident
621#define AAC_QUIRK_SCSI_32 0x0020 621#define AAC_QUIRK_SCSI_32 0x0020
622 622
623/* 623/*
624 * SRC based adapters support the AifReqEvent functions
625 */
626#define AAC_QUIRK_SRC 0x0040
627
628/*
624 * The adapter interface specs all queues to be located in the same 629 * The adapter interface specs all queues to be located in the same
625 * physically contiguous block. The host structure that defines the 630 * physically contiguous block. The host structure that defines the
626 * commuication queues will assume they are each a separate physically 631 * commuication queues will assume they are each a separate physically
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index a943bd230bc2..79871f3519ff 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -236,10 +236,10 @@ static struct aac_driver_ident aac_drivers[] = {
236 { aac_rx_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Catch All */ 236 { aac_rx_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Catch All */
237 { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Rocket Catch All */ 237 { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec Rocket Catch All */
238 { aac_nark_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec NEMER/ARK Catch All */ 238 { aac_nark_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec NEMER/ARK Catch All */
239 { aac_src_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec PMC Series 6 (Tupelo) */ 239 { aac_src_init, "aacraid", "ADAPTEC ", "RAID ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 6 (Tupelo) */
240 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec PMC Series 7 (Denali) */ 240 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 7 (Denali) */
241 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2 }, /* Adaptec PMC Series 8 */ 241 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2, AAC_QUIRK_SRC }, /* Adaptec PMC Series 8 */
242 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2 } /* Adaptec PMC Series 9 */ 242 { aac_srcv_init, "aacraid", "ADAPTEC ", "RAID ", 2, AAC_QUIRK_SRC } /* Adaptec PMC Series 9 */
243}; 243};
244 244
245/** 245/**
@@ -1299,7 +1299,8 @@ static int aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1299 else 1299 else
1300 shost->this_id = shost->max_id; 1300 shost->this_id = shost->max_id;
1301 1301
1302 aac_intr_normal(aac, 0, 2, 0, NULL); 1302 if (aac_drivers[index].quirks & AAC_QUIRK_SRC)
1303 aac_intr_normal(aac, 0, 2, 0, NULL);
1303 1304
1304 /* 1305 /*
1305 * dmb - we may need to move the setting of these parms somewhere else once 1306 * dmb - we may need to move the setting of these parms somewhere else once
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 6a4df5a315e9..6bff13e7afc7 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7975,13 +7975,14 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
7975 ActiveCableEventData = 7975 ActiveCableEventData =
7976 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData; 7976 (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
7977 if (ActiveCableEventData->ReasonCode == 7977 if (ActiveCableEventData->ReasonCode ==
7978 MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) 7978 MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) {
7979 pr_info(MPT3SAS_FMT "Currently an active cable with ReceptacleID %d", 7979 pr_info(MPT3SAS_FMT "Currently an active cable with ReceptacleID %d",
7980 ioc->name, ActiveCableEventData->ReceptacleID); 7980 ioc->name, ActiveCableEventData->ReceptacleID);
7981 pr_info("cannot be powered and devices connected to this active cable"); 7981 pr_info("cannot be powered and devices connected to this active cable");
7982 pr_info("will not be seen. This active cable"); 7982 pr_info("will not be seen. This active cable");
7983 pr_info("requires %d mW of power", 7983 pr_info("requires %d mW of power",
7984 ActiveCableEventData->ActiveCablePowerRequirement); 7984 ActiveCableEventData->ActiveCablePowerRequirement);
7985 }
7985 break; 7986 break;
7986 7987
7987 default: /* ignore the rest */ 7988 default: /* ignore the rest */
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b2e332af0f51..c71344aebdbb 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -821,9 +821,12 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
821 } 821 }
822 822
823 /* 823 /*
824 * If we finished all bytes in the request we are done now. 824 * special case: failed zero length commands always need to
825 * drop down into the retry code. Otherwise, if we finished
826 * all bytes in the request we are done now.
825 */ 827 */
826 if (!scsi_end_request(req, error, good_bytes, 0)) 828 if (!(blk_rq_bytes(req) == 0 && error) &&
829 !scsi_end_request(req, error, good_bytes, 0))
827 return; 830 return;
828 831
829 /* 832 /*
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 428c03ef02b2..f459dff30512 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1398,11 +1398,15 @@ static int media_not_present(struct scsi_disk *sdkp,
1398 **/ 1398 **/
1399static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing) 1399static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
1400{ 1400{
1401 struct scsi_disk *sdkp = scsi_disk(disk); 1401 struct scsi_disk *sdkp = scsi_disk_get(disk);
1402 struct scsi_device *sdp = sdkp->device; 1402 struct scsi_device *sdp;
1403 struct scsi_sense_hdr *sshdr = NULL; 1403 struct scsi_sense_hdr *sshdr = NULL;
1404 int retval; 1404 int retval;
1405 1405
1406 if (!sdkp)
1407 return 0;
1408
1409 sdp = sdkp->device;
1406 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n")); 1410 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_check_events\n"));
1407 1411
1408 /* 1412 /*
@@ -1459,6 +1463,7 @@ out:
1459 kfree(sshdr); 1463 kfree(sshdr);
1460 retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0; 1464 retval = sdp->changed ? DISK_EVENT_MEDIA_CHANGE : 0;
1461 sdp->changed = 0; 1465 sdp->changed = 0;
1466 scsi_disk_put(sdkp);
1462 return retval; 1467 return retval;
1463} 1468}
1464 1469
diff --git a/drivers/thermal/int340x_thermal/int3406_thermal.c b/drivers/thermal/int340x_thermal/int3406_thermal.c
index 13d431cbd29e..a578cd257db4 100644
--- a/drivers/thermal/int340x_thermal/int3406_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3406_thermal.c
@@ -177,7 +177,7 @@ static int int3406_thermal_probe(struct platform_device *pdev)
177 return -ENODEV; 177 return -ENODEV;
178 d->raw_bd = bd; 178 d->raw_bd = bd;
179 179
180 ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br); 180 ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br, NULL);
181 if (ret) 181 if (ret)
182 return ret; 182 return ret;
183 183
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 82c4d2e45319..95103054c0e4 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -120,17 +120,6 @@ config UNIX98_PTYS
120 All modern Linux systems use the Unix98 ptys. Say Y unless 120 All modern Linux systems use the Unix98 ptys. Say Y unless
121 you're on an embedded system and want to conserve memory. 121 you're on an embedded system and want to conserve memory.
122 122
123config DEVPTS_MULTIPLE_INSTANCES
124 bool "Support multiple instances of devpts"
125 depends on UNIX98_PTYS
126 default n
127 ---help---
128 Enable support for multiple instances of devpts filesystem.
129 If you want to have isolated PTY namespaces (eg: in containers),
130 say Y here. Otherwise, say N. If enabled, each mount of devpts
131 filesystem with the '-o newinstance' option will create an
132 independent PTY namespace.
133
134config LEGACY_PTYS 123config LEGACY_PTYS
135 bool "Legacy (BSD) PTY support" 124 bool "Legacy (BSD) PTY support"
136 default y 125 default y
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index dd4b8417e7f4..f856c4544eea 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -668,7 +668,7 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty)
668 else 668 else
669 fsi = tty->link->driver_data; 669 fsi = tty->link->driver_data;
670 devpts_kill_index(fsi, tty->index); 670 devpts_kill_index(fsi, tty->index);
671 devpts_put_ref(fsi); 671 devpts_release(fsi);
672} 672}
673 673
674static const struct tty_operations ptm_unix98_ops = { 674static const struct tty_operations ptm_unix98_ops = {
@@ -733,10 +733,11 @@ static int ptmx_open(struct inode *inode, struct file *filp)
733 if (retval) 733 if (retval)
734 return retval; 734 return retval;
735 735
736 fsi = devpts_get_ref(inode, filp); 736 fsi = devpts_acquire(filp);
737 retval = -ENODEV; 737 if (IS_ERR(fsi)) {
738 if (!fsi) 738 retval = PTR_ERR(fsi);
739 goto out_free_file; 739 goto out_free_file;
740 }
740 741
741 /* find a device that is not in use. */ 742 /* find a device that is not in use. */
742 mutex_lock(&devpts_mutex); 743 mutex_lock(&devpts_mutex);
@@ -745,7 +746,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
745 746
746 retval = index; 747 retval = index;
747 if (index < 0) 748 if (index < 0)
748 goto out_put_ref; 749 goto out_put_fsi;
749 750
750 751
751 mutex_lock(&tty_mutex); 752 mutex_lock(&tty_mutex);
@@ -789,8 +790,8 @@ err_release:
789 return retval; 790 return retval;
790out: 791out:
791 devpts_kill_index(fsi, index); 792 devpts_kill_index(fsi, index);
792out_put_ref: 793out_put_fsi:
793 devpts_put_ref(fsi); 794 devpts_release(fsi);
794out_free_file: 795out_free_file:
795 tty_free_file(filp); 796 tty_free_file(filp);
796 return retval; 797 return retval;
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
index 93601407dab8..688691d9058d 100644
--- a/drivers/vfio/pci/vfio_pci_config.c
+++ b/drivers/vfio/pci/vfio_pci_config.c
@@ -749,7 +749,8 @@ static int vfio_vpd_config_write(struct vfio_pci_device *vdev, int pos,
749 if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4) 749 if (pci_write_vpd(pdev, addr & ~PCI_VPD_ADDR_F, 4, &data) != 4)
750 return count; 750 return count;
751 } else { 751 } else {
752 if (pci_read_vpd(pdev, addr, 4, &data) != 4) 752 data = 0;
753 if (pci_read_vpd(pdev, addr, 4, &data) < 0)
753 return count; 754 return count;
754 *pdata = cpu_to_le32(data); 755 *pdata = cpu_to_le32(data);
755 } 756 }
diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
index e9ea3fef144a..15ecfc9c5f6c 100644
--- a/drivers/vfio/pci/vfio_pci_intrs.c
+++ b/drivers/vfio/pci/vfio_pci_intrs.c
@@ -228,9 +228,9 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
228 228
229static void vfio_intx_disable(struct vfio_pci_device *vdev) 229static void vfio_intx_disable(struct vfio_pci_device *vdev)
230{ 230{
231 vfio_intx_set_signal(vdev, -1);
232 vfio_virqfd_disable(&vdev->ctx[0].unmask); 231 vfio_virqfd_disable(&vdev->ctx[0].unmask);
233 vfio_virqfd_disable(&vdev->ctx[0].mask); 232 vfio_virqfd_disable(&vdev->ctx[0].mask);
233 vfio_intx_set_signal(vdev, -1);
234 vdev->irq_type = VFIO_PCI_NUM_IRQS; 234 vdev->irq_type = VFIO_PCI_NUM_IRQS;
235 vdev->num_ctx = 0; 235 vdev->num_ctx = 0;
236 kfree(vdev->ctx); 236 kfree(vdev->ctx);
@@ -401,13 +401,13 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
401 struct pci_dev *pdev = vdev->pdev; 401 struct pci_dev *pdev = vdev->pdev;
402 int i; 402 int i;
403 403
404 vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
405
406 for (i = 0; i < vdev->num_ctx; i++) { 404 for (i = 0; i < vdev->num_ctx; i++) {
407 vfio_virqfd_disable(&vdev->ctx[i].unmask); 405 vfio_virqfd_disable(&vdev->ctx[i].unmask);
408 vfio_virqfd_disable(&vdev->ctx[i].mask); 406 vfio_virqfd_disable(&vdev->ctx[i].mask);
409 } 407 }
410 408
409 vfio_msi_set_block(vdev, 0, vdev->num_ctx, NULL, msix);
410
411 if (msix) { 411 if (msix) {
412 pci_disable_msix(vdev->pdev); 412 pci_disable_msix(vdev->pdev);
413 kfree(vdev->msix); 413 kfree(vdev->msix);
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 15a65823aad9..2ba19424e4a1 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -515,7 +515,7 @@ static int map_try_harder(struct vfio_domain *domain, dma_addr_t iova,
515 unsigned long pfn, long npage, int prot) 515 unsigned long pfn, long npage, int prot)
516{ 516{
517 long i; 517 long i;
518 int ret; 518 int ret = 0;
519 519
520 for (i = 0; i < npage; i++, pfn++, iova += PAGE_SIZE) { 520 for (i = 0; i < npage; i++, pfn++, iova += PAGE_SIZE) {
521 ret = iommu_map(domain->domain, iova, 521 ret = iommu_map(domain->domain, iova,
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
index 8ea531d2652c..bbfe7e2d4332 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi5_core.c
@@ -51,8 +51,8 @@ static void hdmi_core_ddc_init(struct hdmi_core_data *core)
51{ 51{
52 void __iomem *base = core->base; 52 void __iomem *base = core->base;
53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */ 53 const unsigned long long iclk = 266000000; /* DSS L3 ICLK */
54 const unsigned ss_scl_high = 4000; /* ns */ 54 const unsigned ss_scl_high = 4600; /* ns */
55 const unsigned ss_scl_low = 4700; /* ns */ 55 const unsigned ss_scl_low = 5400; /* ns */
56 const unsigned fs_scl_high = 600; /* ns */ 56 const unsigned fs_scl_high = 600; /* ns */
57 const unsigned fs_scl_low = 1300; /* ns */ 57 const unsigned fs_scl_low = 1300; /* ns */
58 const unsigned sda_hold = 1000; /* ns */ 58 const unsigned sda_hold = 1000; /* ns */
@@ -442,7 +442,7 @@ static void hdmi_core_write_avi_infoframe(struct hdmi_core_data *core,
442 442
443 c = (ptr[1] >> 6) & 0x3; 443 c = (ptr[1] >> 6) & 0x3;
444 m = (ptr[1] >> 4) & 0x3; 444 m = (ptr[1] >> 4) & 0x3;
445 r = (ptr[1] >> 0) & 0x3; 445 r = (ptr[1] >> 0) & 0xf;
446 446
447 itc = (ptr[2] >> 7) & 0x1; 447 itc = (ptr[2] >> 7) & 0x1;
448 ec = (ptr[2] >> 4) & 0x7; 448 ec = (ptr[2] >> 4) & 0x7;