From ae38853249538719c12cb7e7bc302550f5513dae Mon Sep 17 00:00:00 2001 From: Rikard Falkeborn Date: Sat, 26 Sep 2020 22:58:44 +0200 Subject: phy: fsl-imx8mq-usb: Constify imx8mp_usb_phy_ops The only usage of imx8mp_usb_phy_ops is to assign its address to the data field in the of_device_id struct, which is a const void pointer. Make it const to allow the compiler to put it in read-only memory. Signed-off-by: Rikard Falkeborn Link: https://lore.kernel.org/r/20200926205844.34218-1-rikard.falkeborn@gmail.com Signed-off-by: Vinod Koul --- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c index 62d6d6849ad6..47a0c09bc9fa 100644 --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c @@ -131,7 +131,7 @@ static const struct phy_ops imx8mq_usb_phy_ops = { .owner = THIS_MODULE, }; -static struct phy_ops imx8mp_usb_phy_ops = { +static const struct phy_ops imx8mp_usb_phy_ops = { .init = imx8mp_usb_phy_init, .power_on = imx8mq_phy_power_on, .power_off = imx8mq_phy_power_off, -- cgit v1.2.3 From c36f74566cef6b2a377c8830ee216677ddb12706 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Fri, 16 Oct 2020 22:46:10 +0200 Subject: MAINTAINERS: Add entry for Qualcomm IPQ4019 USB PHY Add maintainers entry for the Qualcomm IPQ4019 USB PHY driver. Signed-off-by: Robert Marko Cc: Luka Perkov Link: https://lore.kernel.org/r/20201016204610.2406075-1-robert.marko@sartura.hr Signed-off-by: Vinod Koul --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index e73636b75f29..f01ce8f451c8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14547,6 +14547,14 @@ F: Documentation/devicetree/bindings/mailbox/qcom-ipcc.yaml F: drivers/mailbox/qcom-ipcc.c F: include/dt-bindings/mailbox/qcom-ipcc.h +QUALCOMM IPQ4019 USB PHY DRIVER +M: Robert Marko +M: Luka Perkov +L: linux-arm-msm@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/phy/qcom-usb-ipq4019-phy.yaml +F: drivers/phy/qualcomm/phy-qcom-ipq4019-usb.c + QUALCOMM RMNET DRIVER M: Subash Abhinov Kasiviswanathan M: Sean Tranchetti -- cgit v1.2.3 From b36773c3912e770e92ba57fa0957c1cf4db6e8a7 Mon Sep 17 00:00:00 2001 From: Sudip Mukherjee Date: Mon, 26 Oct 2020 18:00:26 +0000 Subject: misc: hisi_hikey_usb: use PTR_ERR_OR_ZERO Coccinelle suggested using PTR_ERR_OR_ZERO() and looking at the code, we can use PTR_ERR_OR_ZERO() instead of checking IS_ERR() and then doing 'return 0'. Tested-by: Lukas Bulwahn Signed-off-by: Sudip Mukherjee Link: https://lore.kernel.org/r/20201026180026.3350-1-sudipm.mukherjee@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/hisi_hikey_usb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/misc/hisi_hikey_usb.c b/drivers/misc/hisi_hikey_usb.c index cc93569e601c..989d7d129469 100644 --- a/drivers/misc/hisi_hikey_usb.c +++ b/drivers/misc/hisi_hikey_usb.c @@ -168,10 +168,7 @@ static int hisi_hikey_usb_parse_kirin970(struct platform_device *pdev, hisi_hikey_usb->reset = devm_gpiod_get(&pdev->dev, "hub_reset_en_gpio", GPIOD_OUT_HIGH); - if (IS_ERR(hisi_hikey_usb->reset)) - return PTR_ERR(hisi_hikey_usb->reset); - - return 0; + return PTR_ERR_OR_ZERO(hisi_hikey_usb->reset); } static int hisi_hikey_usb_probe(struct platform_device *pdev) -- cgit v1.2.3 From 3f7566f4947834db9b36aeb8b308e91448ba74fc Mon Sep 17 00:00:00 2001 From: Harshal Chaudhari Date: Mon, 26 Oct 2020 21:28:01 +0530 Subject: misc: xilinx_sdfec: add compat_ptr_ioctl() Driver has a trivial helper function to convert the pointer argument and then call the native ioctl handler. But now we have a generic implementation for that, so we can use it. Signed-off-by: Harshal Chaudhari Link: https://lore.kernel.org/r/20201026155801.16053-1-harshalchau04@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/xilinx_sdfec.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index 92291292756a..6f252793dceb 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -1016,14 +1016,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, return rval; } -#ifdef CONFIG_COMPAT -static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd, - unsigned long data) -{ - return xsdfec_dev_ioctl(file, cmd, (unsigned long)compat_ptr(data)); -} -#endif - static __poll_t xsdfec_poll(struct file *file, poll_table *wait) { __poll_t mask = 0; @@ -1054,9 +1046,7 @@ static const struct file_operations xsdfec_fops = { .release = xsdfec_dev_release, .unlocked_ioctl = xsdfec_dev_ioctl, .poll = xsdfec_poll, -#ifdef CONFIG_COMPAT - .compat_ioctl = xsdfec_dev_compat_ioctl, -#endif + .compat_ioctl = compat_ptr_ioctl, }; static int xsdfec_parse_of(struct xsdfec_dev *xsdfec) -- cgit v1.2.3 From ee19f644c4594d1b8382f1538c19396f92c3c171 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 26 Sep 2020 01:58:27 +0200 Subject: dt-bindings: phy: Drop reset-gpios from marvell,mmp3-hsic-phy This has been added in error -- the PHY block doesn't have a reset pin. Signed-off-by: Lubomir Rintel Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20200925235828.228626-2-lkundrak@v3.sk Signed-off-by: Vinod Koul --- Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml b/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml index 00609ace677c..30e290c57930 100644 --- a/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml +++ b/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml @@ -18,27 +18,20 @@ properties: maxItems: 1 description: base address of the device - reset-gpios: - maxItems: 1 - description: GPIO connected to reset - "#phy-cells": const: 0 required: - compatible - reg - - reset-gpios - "#phy-cells" additionalProperties: false examples: - | - #include hsic-phy@f0001800 { compatible = "marvell,mmp3-hsic-phy"; reg = <0xf0001800 0x40>; - reset-gpios = <&gpio 63 GPIO_ACTIVE_HIGH>; #phy-cells = <0>; }; -- cgit v1.2.3 From a1b87f1aac4dba2bac0e0019a9c05f7efa36c37d Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 26 Sep 2020 01:58:28 +0200 Subject: dt-bindings: phy: Allow BSD licensing of marvell,mmp3-hsic-phy.yaml I wrote this binding and I'm fine with it being GPL + BSD dual-licensed, as is recommended for new DT bindings. Signed-off-by: Lubomir Rintel Acked-by: Rob Herring Link: https://lore.kernel.org/r/20200925235828.228626-3-lkundrak@v3.sk Signed-off-by: Vinod Koul --- Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml b/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml index 30e290c57930..ff255aa4cc10 100644 --- a/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml +++ b/Documentation/devicetree/bindings/phy/marvell,mmp3-hsic-phy.yaml @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) # Copyright 2019 Lubomir Rintel %YAML 1.2 --- -- cgit v1.2.3 From 0347c69214f4b600f40c0dc58945dc2798e2b3d9 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Sat, 26 Sep 2020 01:58:29 +0200 Subject: phy: Add USB HSIC PHY driver for Marvell MMP3 SoC Add PHY driver for the HSICs found on Marvell MMP3 SoC. The driver is rather straightforward -- the PHY essentially just needs to be enabled. Signed-off-by: Lubomir Rintel Link: https://lore.kernel.org/r/20200925235828.228626-4-lkundrak@v3.sk Signed-off-by: Vinod Koul --- drivers/phy/marvell/Kconfig | 12 ++++++ drivers/phy/marvell/Makefile | 1 + drivers/phy/marvell/phy-mmp3-hsic.c | 82 +++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/phy/marvell/phy-mmp3-hsic.c diff --git a/drivers/phy/marvell/Kconfig b/drivers/phy/marvell/Kconfig index 8f6273c837ec..6c96f2bf5266 100644 --- a/drivers/phy/marvell/Kconfig +++ b/drivers/phy/marvell/Kconfig @@ -116,3 +116,15 @@ config PHY_MMP3_USB The PHY driver will be used by Marvell udc/ehci/otg driver. To compile this driver as a module, choose M here. + +config PHY_MMP3_HSIC + tristate "Marvell MMP3 USB HSIC PHY Driver" + depends on MACH_MMP3_DT || COMPILE_TEST + select GENERIC_PHY + help + Enable this to support Marvell MMP3 USB HSIC PHY driver for + Marvell MMP3 SoC. This driver will be used my the Marvell EHCI + driver to initialize the interface to internal USB HSIC + components on MMP3-based boards. + + To compile this driver as a module, choose M here. diff --git a/drivers/phy/marvell/Makefile b/drivers/phy/marvell/Makefile index 5a106b1549f4..7f296ef02829 100644 --- a/drivers/phy/marvell/Makefile +++ b/drivers/phy/marvell/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_ARMADA375_USBCLUSTER_PHY) += phy-armada375-usb2.o obj-$(CONFIG_PHY_BERLIN_SATA) += phy-berlin-sata.o obj-$(CONFIG_PHY_BERLIN_USB) += phy-berlin-usb.o obj-$(CONFIG_PHY_MMP3_USB) += phy-mmp3-usb.o +obj-$(CONFIG_PHY_MMP3_HSIC) += phy-mmp3-hsic.o obj-$(CONFIG_PHY_MVEBU_A3700_COMPHY) += phy-mvebu-a3700-comphy.o obj-$(CONFIG_PHY_MVEBU_A3700_UTMI) += phy-mvebu-a3700-utmi.o obj-$(CONFIG_PHY_MVEBU_A38X_COMPHY) += phy-armada38x-comphy.o diff --git a/drivers/phy/marvell/phy-mmp3-hsic.c b/drivers/phy/marvell/phy-mmp3-hsic.c new file mode 100644 index 000000000000..47c1e8894939 --- /dev/null +++ b/drivers/phy/marvell/phy-mmp3-hsic.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2020 Lubomir Rintel + */ + +#include +#include +#include +#include +#include + +#define HSIC_CTRL 0x08 +#define HSIC_ENABLE BIT(7) +#define PLL_BYPASS BIT(4) + +static int mmp3_hsic_phy_init(struct phy *phy) +{ + void __iomem *base = (void __iomem *)phy_get_drvdata(phy); + u32 hsic_ctrl; + + hsic_ctrl = readl_relaxed(base + HSIC_CTRL); + hsic_ctrl |= HSIC_ENABLE; + hsic_ctrl |= PLL_BYPASS; + writel_relaxed(hsic_ctrl, base + HSIC_CTRL); + + return 0; +} + +static const struct phy_ops mmp3_hsic_phy_ops = { + .init = mmp3_hsic_phy_init, + .owner = THIS_MODULE, +}; + +static const struct of_device_id mmp3_hsic_phy_of_match[] = { + { .compatible = "marvell,mmp3-hsic-phy", }, + { }, +}; +MODULE_DEVICE_TABLE(of, mmp3_hsic_phy_of_match); + +static int mmp3_hsic_phy_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct phy_provider *provider; + struct resource *resource; + void __iomem *base; + struct phy *phy; + + resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); + base = devm_ioremap_resource(dev, resource); + if (IS_ERR(base)) { + dev_err(dev, "failed to remap PHY regs\n"); + return PTR_ERR(base); + } + + phy = devm_phy_create(dev, NULL, &mmp3_hsic_phy_ops); + if (IS_ERR(phy)) { + dev_err(dev, "failed to create PHY\n"); + return PTR_ERR(phy); + } + + phy_set_drvdata(phy, (void *)base); + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(provider)) { + dev_err(dev, "failed to register PHY provider\n"); + return PTR_ERR(provider); + } + + return 0; +} + +static struct platform_driver mmp3_hsic_phy_driver = { + .probe = mmp3_hsic_phy_probe, + .driver = { + .name = "mmp3-hsic-phy", + .of_match_table = mmp3_hsic_phy_of_match, + }, +}; +module_platform_driver(mmp3_hsic_phy_driver); + +MODULE_AUTHOR("Lubomir Rintel "); +MODULE_DESCRIPTION("Marvell MMP3 USB HSIC PHY Driver"); +MODULE_LICENSE("GPL"); -- cgit v1.2.3 From c62b1f97e744039f01ec789ce01dfa0a8c9a1a99 Mon Sep 17 00:00:00 2001 From: Sangmoon Kim Date: Thu, 29 Oct 2020 15:28:55 +0900 Subject: char: misc: increase DYNAMIC_MINORS value DYNAMIC_MINORS value has been set to 64. Due to this reason, we are facing a module loading fail problem of device driver like below. [ 45.712771] pdic_misc_init - return error : -16 We need to increase this value for registering more misc devices. Signed-off-by: Sangmoon Kim Link: https://lore.kernel.org/r/20201029062855.19757-1-sangmoon.kim@samsung.com Signed-off-by: Greg Kroah-Hartman --- drivers/char/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/misc.c b/drivers/char/misc.c index f6a147427029..ca5141ed5ef3 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -60,7 +60,7 @@ static DEFINE_MUTEX(misc_mtx); /* * Assigned numbers, used for dynamic minors */ -#define DYNAMIC_MINORS 64 /* like dynamic majors */ +#define DYNAMIC_MINORS 128 /* like dynamic majors */ static DECLARE_BITMAP(misc_minors, DYNAMIC_MINORS); #ifdef CONFIG_PROC_FS -- cgit v1.2.3 From f7a6e6c4073c1e03ab18d2229857cfef5e0f8b7b Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 19 Oct 2020 12:18:08 -0700 Subject: misc: mei: remove unneeded break A break is not needed if it is preceded by a return Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201019191808.9891-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/hbm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index a97eb5d47705..686e8b6a4c55 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c @@ -1377,7 +1377,6 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) dev_info(dev->dev, "hbm: stop response: resetting.\n"); /* force the reset */ return -EPROTO; - break; case CLIENT_DISCONNECT_REQ_CMD: dev_dbg(dev->dev, "hbm: disconnect request: message received\n"); -- cgit v1.2.3 From f0f753da73b386deb274486255b857d013fa6069 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Sat, 31 Oct 2020 08:24:56 -0700 Subject: misc: ti-st: st_core: remove unneeded semicolon A semicolon is not needed after a switch statement. Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201031152456.2146104-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index f4ddd1e67015..5a0a5fc3d3ab 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -380,7 +380,7 @@ void st_int_recv(void *disc_data, st_gdata->rx_state = ST_W4_HEADER; st_gdata->rx_count = st_gdata->list[type]->hdr_len; pr_debug("rx_count %ld\n", st_gdata->rx_count); - }; + } ptr++; count--; } -- cgit v1.2.3 From 33fcc5491897504856783335102142676dbee817 Mon Sep 17 00:00:00 2001 From: Gustavo Pimentel Date: Wed, 21 Oct 2020 23:28:10 +0200 Subject: misc: pci_endpoint_test: Remove unnecessary verification The first condition of the if statement can never be true, because bar variable is an enum variable type defined between 0 and 5, and also bar variable acquires the value from arg function parameter which is an unsigned long variable. The constant 5 was replaced the the equivalent enum type, in this case BAR_5. Signed-off-by: Gustavo Pimentel Link: https://lore.kernel.org/r/142cbbc215bed4243a219ea17b46f4256ceccb22.1603315690.git.gustavo.pimentel@synopsys.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/pci_endpoint_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 146ca6fb3260..ea9c2c085298 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -708,7 +708,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, switch (cmd) { case PCITEST_BAR: bar = arg; - if (bar < 0 || bar > 5) + if (bar > BAR_5) goto ret; if (is_am654_pci_dev(pdev) && bar == BAR_0) goto ret; -- cgit v1.2.3 From c78c95f919539cad0308e7de0d5d0d656e4a8e98 Mon Sep 17 00:00:00 2001 From: Harshal Chaudhari Date: Sun, 1 Nov 2020 22:39:49 +0530 Subject: misc: xilinx-sdfec: remove check for ioctl cmd and argument. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if (_IOC_TYPE(cmd) != PP_IOCTL) return -ENOTTY; Invalid ioctl command check normally performs by “default” case. if (_IOC_DIR(cmd) != _IOC_NONE) { argp = (void __user *)arg; if (!argp) return -EINVAL; } And for checking ioctl arguments, copy_from_user()/copy_to_user() checks are enough. Reviewed-by: Arnd Bergmann Signed-off-by: Harshal Chaudhari Link: https://lore.kernel.org/r/20201101170949.18616-1-harshalchau04@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/xilinx_sdfec.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c index 6f252793dceb..23c8448a9c3b 100644 --- a/drivers/misc/xilinx_sdfec.c +++ b/drivers/misc/xilinx_sdfec.c @@ -944,8 +944,8 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, unsigned long data) { struct xsdfec_dev *xsdfec; - void __user *arg = NULL; - int rval = -EINVAL; + void __user *arg = (void __user *)data; + int rval; xsdfec = container_of(fptr->private_data, struct xsdfec_dev, miscdev); @@ -956,16 +956,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, return -EPERM; } - if (_IOC_TYPE(cmd) != XSDFEC_MAGIC) - return -ENOTTY; - - /* check if ioctl argument is present and valid */ - if (_IOC_DIR(cmd) != _IOC_NONE) { - arg = (void __user *)data; - if (!arg) - return rval; - } - switch (cmd) { case XSDFEC_START_DEV: rval = xsdfec_start(xsdfec); @@ -1010,7 +1000,7 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd, rval = xsdfec_is_active(xsdfec, (bool __user *)arg); break; default: - /* Should not get here */ + rval = -ENOTTY; break; } return rval; -- cgit v1.2.3 From e8f50d4bfc8deff61adc74146f130860c4fe356f Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Mon, 2 Nov 2020 14:20:00 +0000 Subject: misc: c2port: core: Make copying name from userspace more secure Currently the 'c2dev' device data is not initialised when it's allocated. There maybe an issue when using strncpy() to populate the 'name' attribute since a NUL terminator may not be provided in all use-cases. To prevent such a failing, let's ensure the 'c2dev' device data area is fully zeroed out on allocation. Cc: Rodolfo Giometti Cc: "Eurotech S.p.A" Cc: David Laight Reported-by: Geert Uytterhoeven Acked-by: Arnd Bergmann Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201102142001.560490-1-lee.jones@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/c2port/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c index 80d87e8a0bea..fb9a1b49ff6d 100644 --- a/drivers/misc/c2port/core.c +++ b/drivers/misc/c2port/core.c @@ -899,7 +899,7 @@ struct c2port_device *c2port_device_register(char *name, unlikely(!ops->c2d_get) || unlikely(!ops->c2d_set)) return ERR_PTR(-EINVAL); - c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL); + c2dev = kzalloc(sizeof(struct c2port_device), GFP_KERNEL); if (unlikely(!c2dev)) return ERR_PTR(-ENOMEM); -- cgit v1.2.3 From a7c392c76a434c71df30ca748aae00d69684ff48 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Mon, 2 Nov 2020 14:20:01 +0000 Subject: misc: ocxl: config: Rename function attribute description Fixes the following W=1 kernel build warning(s): drivers/misc/ocxl/config.c:81: warning: Function parameter or member 'dev' not described in 'get_function_0' drivers/misc/ocxl/config.c:81: warning: Excess function parameter 'device' description in 'get_function_0' Cc: Frederic Barrat Cc: Andrew Donnellan Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: linuxppc-dev@lists.ozlabs.org Acked-by: Frederic Barrat Acked-by: Andrew Donnellan Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20201102142001.560490-2-lee.jones@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ocxl/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/ocxl/config.c b/drivers/misc/ocxl/config.c index 4d490b92d951..a68738f38252 100644 --- a/drivers/misc/ocxl/config.c +++ b/drivers/misc/ocxl/config.c @@ -73,7 +73,7 @@ static int find_dvsec_afu_ctrl(struct pci_dev *dev, u8 afu_idx) /** * get_function_0() - Find a related PCI device (function 0) - * @device: PCI device to match + * @dev: PCI device to match * * Returns a pointer to the related device, or null if not found */ -- cgit v1.2.3 From c7a6252b9472fd96a3dbac40c891eb9f4fe5b4f1 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Thu, 29 Oct 2020 11:54:43 +0200 Subject: mei: bus: do not start a read for disconnected clients Avoid queuing reads and registering rx callbacks in case the client is not connected, to prevent null dereferencing and memory leaks. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20201029095444.957924-3-tomas.winkler@intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/bus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 9cdaa7f3af23..1a54bf3ed0c3 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -276,7 +276,8 @@ static void mei_cl_bus_rx_work(struct work_struct *work) cldev->rx_cb(cldev); mutex_lock(&bus->device_lock); - mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); + if (mei_cl_is_connected(cldev->cl)) + mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); mutex_unlock(&bus->device_lock); } @@ -364,7 +365,10 @@ int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb) INIT_WORK(&cldev->rx_work, mei_cl_bus_rx_work); mutex_lock(&bus->device_lock); - ret = mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); + if (mei_cl_is_connected(cldev->cl)) + ret = mei_cl_read_start(cldev->cl, mei_cl_mtu(cldev->cl), NULL); + else + ret = -ENODEV; mutex_unlock(&bus->device_lock); if (ret && ret != -EBUSY) return ret; -- cgit v1.2.3 From c2192bbc3c507b33dda5858049e0493c073d29fb Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Thu, 29 Oct 2020 11:54:44 +0200 Subject: mei: bus: deinitialize callback functions on init failure If the initialization procedure for receive or receive callback registration on the client bus has failed the caller can't re-run it. Deinitilize the callback pointers and cancel the work to allow the caller to retry. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20201029095444.957924-4-tomas.winkler@intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 1a54bf3ed0c3..76aa0e93748a 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -370,8 +370,11 @@ int mei_cldev_register_rx_cb(struct mei_cl_device *cldev, mei_cldev_cb_t rx_cb) else ret = -ENODEV; mutex_unlock(&bus->device_lock); - if (ret && ret != -EBUSY) + if (ret && ret != -EBUSY) { + cancel_work_sync(&cldev->rx_work); + cldev->rx_cb = NULL; return ret; + } return 0; } @@ -405,8 +408,11 @@ int mei_cldev_register_notif_cb(struct mei_cl_device *cldev, mutex_lock(&bus->device_lock); ret = mei_cl_notify_request(cldev->cl, NULL, 1); mutex_unlock(&bus->device_lock); - if (ret) + if (ret) { + cancel_work_sync(&cldev->notif_work); + cldev->notif_cb = NULL; return ret; + } return 0; } -- cgit v1.2.3 From 061e5379f327c77647b6a16beaf898b1ee71d731 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 19 Oct 2020 12:46:28 -0700 Subject: char: lp: remove unneeded break A break is not needed if it is preceded by a return Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201019194628.14731-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/char/lp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 0ec73917d8dd..862c2fd933c7 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -622,7 +622,6 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd, break; case LPSETIRQ: return -EINVAL; - break; case LPGETIRQ: if (copy_to_user(argp, &LP_IRQ(minor), sizeof(int))) -- cgit v1.2.3 From b61fe3b5963db935dad5bae8f9ced3bed695bb62 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 19 Oct 2020 12:45:03 -0700 Subject: char: mwave: remove unneeded break A break is not needed if it is preceded by a return Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201019194503.14426-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/char/mwave/mwavedd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index e43c876a9223..11272d605ecd 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c @@ -403,7 +403,6 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd, default: return -ENOTTY; - break; } /* switch */ PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_ioctl, exit retval %x\n", retval); -- cgit v1.2.3 From 6a80467a21ca4268f1d97daa1f43b66b86fe3887 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 19 Oct 2020 09:51:12 -0700 Subject: vme: remove unneeded break A break is not needed if it is preceded by a return or goto Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201019165112.29091-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/vme/bridges/vme_tsi148.c | 7 ------- drivers/vme/vme.c | 9 --------- 2 files changed, 16 deletions(-) diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c index 50ae26977a02..1227ea937059 100644 --- a/drivers/vme/bridges/vme_tsi148.c +++ b/drivers/vme/bridges/vme_tsi148.c @@ -506,7 +506,6 @@ static int tsi148_slave_set(struct vme_slave_resource *image, int enabled, default: dev_err(tsi148_bridge->parent, "Invalid address space\n"); return -EINVAL; - break; } /* Convert 64-bit variables to 2x 32-bit variables */ @@ -995,7 +994,6 @@ static int tsi148_master_set(struct vme_master_resource *image, int enabled, dev_err(tsi148_bridge->parent, "Invalid address space\n"); retval = -EINVAL; goto err_aspace; - break; } temp_ctl &= ~(3<<4); @@ -1503,7 +1501,6 @@ static int tsi148_dma_set_vme_src_attributes(struct device *dev, __be32 *attr, default: dev_err(dev, "Invalid address space\n"); return -EINVAL; - break; } if (cycle & VME_SUPER) @@ -1603,7 +1600,6 @@ static int tsi148_dma_set_vme_dest_attributes(struct device *dev, __be32 *attr, default: dev_err(dev, "Invalid address space\n"); return -EINVAL; - break; } if (cycle & VME_SUPER) @@ -1701,7 +1697,6 @@ static int tsi148_dma_list_add(struct vme_dma_list *list, dev_err(tsi148_bridge->parent, "Invalid source type\n"); retval = -EINVAL; goto err_source; - break; } /* Assume last link - this will be over-written by adding another */ @@ -1738,7 +1733,6 @@ static int tsi148_dma_list_add(struct vme_dma_list *list, dev_err(tsi148_bridge->parent, "Invalid destination type\n"); retval = -EINVAL; goto err_dest; - break; } /* Fill out count */ @@ -1964,7 +1958,6 @@ static int tsi148_lm_set(struct vme_lm_resource *lm, unsigned long long lm_base, mutex_unlock(&lm->mtx); dev_err(tsi148_bridge->parent, "Invalid address space\n"); return -EINVAL; - break; } if (cycle & VME_SUPER) diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index b398293980b6..e1a940e43327 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -52,23 +52,18 @@ static struct vme_bridge *find_bridge(struct vme_resource *resource) case VME_MASTER: return list_entry(resource->entry, struct vme_master_resource, list)->parent; - break; case VME_SLAVE: return list_entry(resource->entry, struct vme_slave_resource, list)->parent; - break; case VME_DMA: return list_entry(resource->entry, struct vme_dma_resource, list)->parent; - break; case VME_LM: return list_entry(resource->entry, struct vme_lm_resource, list)->parent; - break; default: printk(KERN_ERR "Unknown resource type\n"); return NULL; - break; } } @@ -179,7 +174,6 @@ size_t vme_get_size(struct vme_resource *resource) return 0; return size; - break; case VME_SLAVE: retval = vme_slave_get(resource, &enabled, &base, &size, &buf_base, &aspace, &cycle); @@ -187,14 +181,11 @@ size_t vme_get_size(struct vme_resource *resource) return 0; return size; - break; case VME_DMA: return 0; - break; default: printk(KERN_ERR "Unknown resource type\n"); return 0; - break; } } EXPORT_SYMBOL(vme_get_size); -- cgit v1.2.3 From 552c08a8e03f09ee7f44950d0f6d9bd4599ff1f6 Mon Sep 17 00:00:00 2001 From: Tom Rix Date: Mon, 19 Oct 2020 12:32:27 -0700 Subject: ipack: iopctal: remove unneeded break A break is not needed if it is preceded by a return Acked-by: Samuel Iglesias Gonsalvez Signed-off-by: Tom Rix Link: https://lore.kernel.org/r/20201019193227.12738-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/ipack/devices/ipoctal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ipack/devices/ipoctal.c b/drivers/ipack/devices/ipoctal.c index d480a514c983..3940714e4397 100644 --- a/drivers/ipack/devices/ipoctal.c +++ b/drivers/ipack/devices/ipoctal.c @@ -544,7 +544,6 @@ static void ipoctal_set_termios(struct tty_struct *tty, break; default: return; - break; } baud = tty_get_baud_rate(tty); -- cgit v1.2.3 From a79db45fa54e2420c9fe977a6a5835c466888b5a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 1 Nov 2020 19:39:13 +0100 Subject: speakup_dummy: log about characters received by the dummy driver The dummy speakup driver is used to check that speakup is working properly, without the need for actually owning the hardware. Some drivers require receiving characters, so we need a way to check that this is working properly. Signed-off-by: Samuel Thibault Link: https://lore.kernel.org/r/20201101183913.yg35cbqpn2ba6cew@function Signed-off-by: Greg Kroah-Hartman --- drivers/accessibility/speakup/speakup_dummy.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/accessibility/speakup/speakup_dummy.c b/drivers/accessibility/speakup/speakup_dummy.c index e393438af81b..63c2f2943282 100644 --- a/drivers/accessibility/speakup/speakup_dummy.c +++ b/drivers/accessibility/speakup/speakup_dummy.c @@ -80,6 +80,11 @@ static struct attribute *synth_attrs[] = { NULL, /* need to NULL terminate the list of attributes */ }; +static void read_buff_add(u_char c) +{ + pr_info("speakup_dummy: got character %02x\n", c); +} + static struct spk_synth synth_dummy = { .name = "dummy", .version = DRV_VERSION, @@ -103,7 +108,7 @@ static struct spk_synth synth_dummy = { .flush = spk_synth_flush, .is_alive = spk_synth_is_alive_restart, .synth_adjust = NULL, - .read_buff_add = NULL, + .read_buff_add = read_buff_add, .get_index = NULL, .indexing = { .command = NULL, -- cgit v1.2.3 From 508155944752f6e51dbc0a7273d933e954e4ed64 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 2 Nov 2020 10:59:45 +0100 Subject: speakup: document the usage of enum values The cursor tracking modes enum, the edge enum, and the read_all commands enum should be used as such in the source code, to make it more readable and make gcc catch missing values in switches. Also, some values of enums are coupled with others, we at least need to document these. Signed-off-by: Samuel Thibault Link: https://lore.kernel.org/r/20201102095945.ap4pdff2dn47hijh@function Signed-off-by: Greg Kroah-Hartman --- drivers/accessibility/speakup/i18n.h | 6 ++++ drivers/accessibility/speakup/main.c | 64 +++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/drivers/accessibility/speakup/i18n.h b/drivers/accessibility/speakup/i18n.h index 2ec6e659d02b..2a607d263234 100644 --- a/drivers/accessibility/speakup/i18n.h +++ b/drivers/accessibility/speakup/i18n.h @@ -23,12 +23,15 @@ enum msg_index_t { MSG_OFF = MSG_STATUS_START, MSG_ON, MSG_NO_WINDOW, + + /* These must be ordered the same as enum cursor_track */ MSG_CURSOR_MSGS_START, MSG_CURSORING_OFF = MSG_CURSOR_MSGS_START, MSG_CURSORING_ON, MSG_HIGHLIGHT_TRACKING, MSG_READ_WINDOW, MSG_READ_ALL, + MSG_EDIT_DONE, MSG_WINDOW_ALREADY_SET, MSG_END_BEFORE_START, @@ -41,11 +44,14 @@ enum msg_index_t { MSG_LEAVING_HELP, MSG_IS_UNASSIGNED, MSG_HELP_INFO, + + /* These must be ordered the same as enum edge */ MSG_EDGE_MSGS_START, MSG_EDGE_TOP = MSG_EDGE_MSGS_START, MSG_EDGE_BOTTOM, MSG_EDGE_LEFT, MSG_EDGE_RIGHT, + MSG_NUMBER, MSG_SPACE, MSG_START, /* A little confusing, given our convention. */ diff --git a/drivers/accessibility/speakup/main.c b/drivers/accessibility/speakup/main.c index be79b2135fac..b9b51bc542df 100644 --- a/drivers/accessibility/speakup/main.c +++ b/drivers/accessibility/speakup/main.c @@ -90,19 +90,18 @@ const u_char spk_key_defaults[] = { #include "speakupmap.h" }; -/* Speakup Cursor Track Variables */ -static int cursor_track = 1, prev_cursor_track = 1; - -/* cursor track modes, must be ordered same as cursor_msgs */ -enum { +/* cursor track modes, must be ordered same as cursor_msgs in enum msg_index_t */ +enum cursor_track { CT_Off = 0, CT_On, CT_Highlight, CT_Window, - CT_Max + CT_Max, + read_all_mode = CT_Max, }; -#define read_all_mode CT_Max +/* Speakup Cursor Track Variables */ +static enum cursor_track cursor_track = 1, prev_cursor_track = 1; static struct tty_struct *tty; @@ -405,15 +404,17 @@ static void say_attributes(struct vc_data *vc) synth_printf("%s\n", spk_msg_get(MSG_COLORS_START + bg)); } -enum { - edge_top = 1, +/* must be ordered same as edge_msgs in enum msg_index_t */ +enum edge { + edge_none = 0, + edge_top, edge_bottom, edge_left, edge_right, edge_quiet }; -static void announce_edge(struct vc_data *vc, int msg_id) +static void announce_edge(struct vc_data *vc, enum edge msg_id) { if (spk_bleeps & 1) bleep(spk_y); @@ -608,7 +609,8 @@ static void say_prev_word(struct vc_data *vc) { u_char temp; u16 ch; - u_short edge_said = 0, last_state = 0, state = 0; + enum edge edge_said = edge_none; + u_short last_state = 0, state = 0; spk_parked |= 0x01; @@ -653,7 +655,7 @@ static void say_prev_word(struct vc_data *vc) } if (spk_x == 0 && edge_said == edge_quiet) edge_said = edge_left; - if (edge_said > 0 && edge_said < edge_quiet) + if (edge_said > edge_none && edge_said < edge_quiet) announce_edge(vc, edge_said); say_word(vc); } @@ -662,7 +664,8 @@ static void say_next_word(struct vc_data *vc) { u_char temp; u16 ch; - u_short edge_said = 0, last_state = 2, state = 0; + enum edge edge_said = edge_none; + u_short last_state = 2, state = 0; spk_parked |= 0x01; if (spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows - 1) { @@ -694,7 +697,7 @@ static void say_next_word(struct vc_data *vc) spk_pos += 2; last_state = state; } - if (edge_said > 0) + if (edge_said > edge_none) announce_edge(vc, edge_said); say_word(vc); } @@ -1366,31 +1369,30 @@ static void speakup_deallocate(struct vc_data *vc) speakup_console[vc_num] = NULL; } +enum read_all_command { + RA_NEXT_SENT = KVAL(K_DOWN)+1, + RA_PREV_LINE = KVAL(K_LEFT)+1, + RA_NEXT_LINE = KVAL(K_RIGHT)+1, + RA_PREV_SENT = KVAL(K_UP)+1, + RA_DOWN_ARROW, + RA_TIMER, + RA_FIND_NEXT_SENT, + RA_FIND_PREV_SENT, +}; + static u_char is_cursor; static u_long old_cursor_pos, old_cursor_x, old_cursor_y; static int cursor_con; static void reset_highlight_buffers(struct vc_data *); -static int read_all_key; +static enum read_all_command read_all_key; static int in_keyboard_notifier; -static void start_read_all_timer(struct vc_data *vc, int command); - -enum { - RA_NOTHING, - RA_NEXT_SENT, - RA_PREV_LINE, - RA_NEXT_LINE, - RA_PREV_SENT, - RA_DOWN_ARROW, - RA_TIMER, - RA_FIND_NEXT_SENT, - RA_FIND_PREV_SENT, -}; +static void start_read_all_timer(struct vc_data *vc, enum read_all_command command); -static void kbd_fakekey2(struct vc_data *vc, int command) +static void kbd_fakekey2(struct vc_data *vc, enum read_all_command command) { del_timer(&cursor_timer); speakup_fake_down_arrow(); @@ -1427,7 +1429,7 @@ static void stop_read_all(struct vc_data *vc) spk_do_flush(); } -static void start_read_all_timer(struct vc_data *vc, int command) +static void start_read_all_timer(struct vc_data *vc, enum read_all_command command) { struct var_t *cursor_timeout; @@ -1438,7 +1440,7 @@ static void start_read_all_timer(struct vc_data *vc, int command) jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); } -static void handle_cursor_read_all(struct vc_data *vc, int command) +static void handle_cursor_read_all(struct vc_data *vc, enum read_all_command command) { int indcount, sentcount, rv, sn; -- cgit v1.2.3 From f96a15c7698ede0e60bf5b4b9b5d0c7d0a0b505f Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 8 Nov 2020 19:18:24 +0100 Subject: speakup: Document read_all_doc shortcut This was implemented a long time ago, but never actually added to the documentation. Signed-off-by: Samuel Thibault Link: https://lore.kernel.org/r/20201108181824.bso5exam72b4p4tk@function Signed-off-by: Greg Kroah-Hartman --- Documentation/admin-guide/spkguide.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/admin-guide/spkguide.txt b/Documentation/admin-guide/spkguide.txt index 3782f6a09e97..5ff6a0fe87d1 100644 --- a/Documentation/admin-guide/spkguide.txt +++ b/Documentation/admin-guide/spkguide.txt @@ -344,6 +344,7 @@ spk key_slash = say_attributes spk key_8 = speakup_paste shift spk key_m = say_first_char ctrl spk key_semicolon = say_last_char +spk key_r = read_all_doc 5. The Speakup Sys System -- cgit v1.2.3 From 7bbd2584ead19a8fdd72c19b1fdf25369954aee6 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 23 Oct 2020 18:33:03 +0200 Subject: mei: bus: fix a kernel-doc markup A function has a different name between their prototype and its kernel-doc markup. Signed-off-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/56b4cc6308fe6b6133b95c7d9116ed6fbaaabe9f.1603469755.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/misc/mei/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index 76aa0e93748a..7fe48baa103a 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c @@ -1047,7 +1047,7 @@ static struct mei_cl_device *mei_cl_bus_dev_alloc(struct mei_device *bus, } /** - * mei_cl_dev_setup - setup me client device + * mei_cl_bus_dev_setup - setup me client device * run fix up routines and set the device name * * @bus: mei device -- cgit v1.2.3 From 9f38abefd37af8726d59706b9b84530630b6b620 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 23 Oct 2020 18:33:17 +0200 Subject: uio: fix some kernel-doc markups The definitions for (devm_)uio_register_device should be at the header file, as the macros are there. The ones inside uio.c refer, instead, to __(devm_)uio_register_device. Update them and add new kernel-doc markups for the macros. Signed-off-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/82ab7b68d271aeda7396e369ff8a629491b9d628.1603469755.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/uio/uio.c | 4 ++-- include/linux/uio_driver.h | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index 6dca744e39e9..01b349c1b923 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -906,7 +906,7 @@ static void uio_device_release(struct device *dev) } /** - * uio_register_device - register a new userspace IO device + * __uio_register_device - register a new userspace IO device * @owner: module that creates the new device * @parent: parent device * @info: UIO device capabilities @@ -1002,7 +1002,7 @@ static void devm_uio_unregister_device(struct device *dev, void *res) } /** - * devm_uio_register_device - Resource managed uio_register_device() + * __devm_uio_register_device - Resource managed uio_register_device() * @owner: module that creates the new device * @parent: parent device * @info: UIO device capabilities diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index 54bf6b118401..47c5962b876b 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -117,6 +117,14 @@ extern int __must_check struct uio_info *info); /* use a define to avoid include chaining to get THIS_MODULE */ + +/** + * uio_register_device - register a new userspace IO device + * @parent: parent device + * @info: UIO device capabilities + * + * returns zero on success or a negative error code. + */ #define uio_register_device(parent, info) \ __uio_register_device(THIS_MODULE, parent, info) @@ -129,6 +137,14 @@ extern int __must_check struct uio_info *info); /* use a define to avoid include chaining to get THIS_MODULE */ + +/** + * devm_uio_register_device - Resource managed uio_register_device() + * @parent: parent device + * @info: UIO device capabilities + * + * returns zero on success or a negative error code. + */ #define devm_uio_register_device(parent, info) \ __devm_uio_register_device(THIS_MODULE, parent, info) -- cgit v1.2.3 From 8bd160690a6c064fd4459d006e50ba7cc7a7669c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 23 Oct 2020 18:33:20 +0200 Subject: vme: fix two kernel-doc markups Some identifiers have different names between their prototypes and the kernel-doc markup. Signed-off-by: Mauro Carvalho Chehab Link: https://lore.kernel.org/r/51bfb6724975302f66d64e4ad71de451a7cbbf99.1603469755.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/vme/vme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index e1a940e43327..54d7963c1078 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -68,7 +68,7 @@ static struct vme_bridge *find_bridge(struct vme_resource *resource) } /** - * vme_free_consistent - Allocate contiguous memory. + * vme_alloc_consistent - Allocate contiguous memory. * @resource: Pointer to VME resource. * @size: Size of allocation required. * @dma: Pointer to variable to store physical address of allocation. @@ -638,7 +638,7 @@ int vme_master_get(struct vme_resource *resource, int *enabled, EXPORT_SYMBOL(vme_master_get); /** - * vme_master_write - Read data from VME space into a buffer. + * vme_master_read - Read data from VME space into a buffer. * @resource: Pointer to VME master resource. * @buf: Pointer to buffer where data should be transferred. * @count: Number of bytes to transfer. -- cgit v1.2.3 From a67c43ac37f80b5e7e1876e8f5f7df62027445c8 Mon Sep 17 00:00:00 2001 From: Kai Ye Date: Mon, 2 Nov 2020 17:39:24 +0800 Subject: uacce: delete some redundant code. Delete some redundant code. Reviewed-by: Zhou Wang Reviewed-by: Jonathan Cameron Acked-by: Zhangfei Gao Signed-off-by: Kai Ye Link: https://lore.kernel.org/r/1604309965-21752-2-git-send-email-yekai13@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/uacce/uacce.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index 56dd98ab5a81..eb827f18c031 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -231,17 +231,6 @@ static int uacce_fops_mmap(struct file *filep, struct vm_area_struct *vma) switch (type) { case UACCE_QFRT_MMIO: - if (!uacce->ops->mmap) { - ret = -EINVAL; - goto out_with_lock; - } - - ret = uacce->ops->mmap(q, vma, qfr); - if (ret) - goto out_with_lock; - - break; - case UACCE_QFRT_DUS: if (!uacce->ops->mmap) { ret = -EINVAL; -- cgit v1.2.3 From 385997dc17ab4927bad332c1283dc461a973ab1d Mon Sep 17 00:00:00 2001 From: Kai Ye Date: Mon, 2 Nov 2020 17:39:25 +0800 Subject: uacce: modify the module author information. The spelling of "Hisilicon" is modified. Reviewed-by: Zhou Wang Reviewed-by: Jonathan Cameron Acked-by: Zhangfei Gao Signed-off-by: Kai Ye Link: https://lore.kernel.org/r/1604309965-21752-3-git-send-email-yekai13@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/misc/uacce/uacce.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/uacce/uacce.c b/drivers/misc/uacce/uacce.c index eb827f18c031..d07af4edfcac 100644 --- a/drivers/misc/uacce/uacce.c +++ b/drivers/misc/uacce/uacce.c @@ -522,5 +522,5 @@ subsys_initcall(uacce_init); module_exit(uacce_exit); MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Hisilicon Tech. Co., Ltd."); +MODULE_AUTHOR("HiSilicon Tech. Co., Ltd."); MODULE_DESCRIPTION("Accelerator interface for Userland applications"); -- cgit v1.2.3 From 6c20032c22d9823f35cd673b7f69ce73a49582b0 Mon Sep 17 00:00:00 2001 From: Andrew Bridges Date: Tue, 27 Oct 2020 22:56:55 +0000 Subject: Android: binder: added a missing blank line after declaration Fixed a coding style issue. Signed-off-by: Andrew Bridges Link: https://lore.kernel.org/r/20201027225655.650922-1-andrew@slova.app Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index b5117576792b..3241d233a12d 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3614,6 +3614,7 @@ static int binder_thread_write(struct binder_proc *proc, ret = -1; if (increment && !target) { struct binder_node *ctx_mgr_node; + mutex_lock(&context->context_mgr_node_lock); ctx_mgr_node = context->binder_context_mgr_node; if (ctx_mgr_node) { -- cgit v1.2.3 From 88f6c77927e4aee04e0193fd94e13a55753a72b0 Mon Sep 17 00:00:00 2001 From: Zhang Qilong Date: Mon, 26 Oct 2020 19:03:14 +0800 Subject: binder: change error code from postive to negative in binder_transaction Depending on the context, the error return value here (extra_buffers_size < added_size) should be negative. Acked-by: Martijn Coenen Acked-by: Christian Brauner Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201026110314.135481-1-zhangqilong3@huawei.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 3241d233a12d..cf70cb91e9f6 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -3103,7 +3103,7 @@ static void binder_transaction(struct binder_proc *proc, if (extra_buffers_size < added_size) { /* integer overflow of extra_buffers_size */ return_error = BR_FAILED_REPLY; - return_error_param = EINVAL; + return_error_param = -EINVAL; return_error_line = __LINE__; goto err_bad_extra_size; } -- cgit v1.2.3 From 17adb469bf1ef3c62e9356ab84449df6cad28ed5 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 22 Oct 2020 00:15:50 -0700 Subject: firmware: gsmi: Drop the use of dma_pool_* API functions GSMI driver uses dma_pool_* API functions for buffer allocation because it requires that the SMI buffers are allocated within 32-bit physical address space. However, this does not work well with IOMMU since there is no real device and hence no domain associated with the device. Since this is not a real device, it does not require any device address(IOVA) for the buffer allocations. The only requirement is to ensure that the physical address allocated to the buffer is within 32-bit physical address space. This is because the buffers have nothing to do with DMA at all. It is required for communication with firmware executing in SMI mode which has access only to the bottom 4GiB of memory. Hence, this change switches to using a SLAB cache created with SLAB_CACHE_DMA32 that guarantees that the allocation happens from the DMA32 memory zone. All calls to dma_pool_* are replaced with kmem_cache_*. In addition to that, all the code for managing the dma_pool for GSMI platform device is dropped. Signed-off-by: Furquan Shaikh Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20201022071550.1192947-1-furquan@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/firmware/google/gsmi.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c index 7d9367b22010..3d77f26c1e8c 100644 --- a/drivers/firmware/google/gsmi.c +++ b/drivers/firmware/google/gsmi.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -85,7 +84,6 @@ struct gsmi_buf { u8 *start; /* start of buffer */ size_t length; /* length of buffer */ - dma_addr_t handle; /* dma allocation handle */ u32 address; /* physical address of buffer */ }; @@ -97,7 +95,7 @@ static struct gsmi_device { spinlock_t lock; /* serialize access to SMIs */ u16 smi_cmd; /* SMI command port */ int handshake_type; /* firmware handler interlock type */ - struct dma_pool *dma_pool; /* DMA buffer pool */ + struct kmem_cache *mem_pool; /* kmem cache for gsmi_buf allocations */ } gsmi_dev; /* Packed structures for communicating with the firmware */ @@ -157,8 +155,7 @@ static struct gsmi_buf *gsmi_buf_alloc(void) } /* allocate buffer in 32bit address space */ - smibuf->start = dma_pool_alloc(gsmi_dev.dma_pool, GFP_KERNEL, - &smibuf->handle); + smibuf->start = kmem_cache_alloc(gsmi_dev.mem_pool, GFP_KERNEL); if (!smibuf->start) { printk(KERN_ERR "gsmi: failed to allocate name buffer\n"); kfree(smibuf); @@ -176,8 +173,7 @@ static void gsmi_buf_free(struct gsmi_buf *smibuf) { if (smibuf) { if (smibuf->start) - dma_pool_free(gsmi_dev.dma_pool, smibuf->start, - smibuf->handle); + kmem_cache_free(gsmi_dev.mem_pool, smibuf->start); kfree(smibuf); } } @@ -914,9 +910,20 @@ static __init int gsmi_init(void) spin_lock_init(&gsmi_dev.lock); ret = -ENOMEM; - gsmi_dev.dma_pool = dma_pool_create("gsmi", &gsmi_dev.pdev->dev, - GSMI_BUF_SIZE, GSMI_BUF_ALIGN, 0); - if (!gsmi_dev.dma_pool) + + /* + * SLAB cache is created using SLAB_CACHE_DMA32 to ensure that the + * allocations for gsmi_buf come from the DMA32 memory zone. These + * buffers have nothing to do with DMA. They are required for + * communication with firmware executing in SMI mode which can only + * access the bottom 4GiB of physical memory. Since DMA32 memory zone + * guarantees allocation under the 4GiB boundary, this driver creates + * a SLAB cache with SLAB_CACHE_DMA32 flag. + */ + gsmi_dev.mem_pool = kmem_cache_create("gsmi", GSMI_BUF_SIZE, + GSMI_BUF_ALIGN, + SLAB_CACHE_DMA32, NULL); + if (!gsmi_dev.mem_pool) goto out_err; /* @@ -1032,7 +1039,7 @@ out_err: gsmi_buf_free(gsmi_dev.param_buf); gsmi_buf_free(gsmi_dev.data_buf); gsmi_buf_free(gsmi_dev.name_buf); - dma_pool_destroy(gsmi_dev.dma_pool); + kmem_cache_destroy(gsmi_dev.mem_pool); platform_device_unregister(gsmi_dev.pdev); pr_info("gsmi: failed to load: %d\n", ret); #ifdef CONFIG_PM @@ -1057,7 +1064,7 @@ static void __exit gsmi_exit(void) gsmi_buf_free(gsmi_dev.param_buf); gsmi_buf_free(gsmi_dev.data_buf); gsmi_buf_free(gsmi_dev.name_buf); - dma_pool_destroy(gsmi_dev.dma_pool); + kmem_cache_destroy(gsmi_dev.mem_pool); platform_device_unregister(gsmi_dev.pdev); #ifdef CONFIG_PM platform_driver_unregister(&gsmi_driver_info); -- cgit v1.2.3 From 421518a2740fc95ab3a47109228bf230dee4040b Mon Sep 17 00:00:00 2001 From: "Frankie.Chang" Date: Wed, 11 Nov 2020 11:02:42 +0800 Subject: binder: move structs from core file to header file Moving all structs to header file makes module more extendable, and makes all these structs to be defined in the same file. Signed-off-by: Frankie.Chang Acked-by: Todd Kjos Link: https://lore.kernel.org/r/1605063764-12930-2-git-send-email-Frankie.Chang@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 406 -------------------------------------- drivers/android/binder_internal.h | 406 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 406 insertions(+), 406 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index cf70cb91e9f6..abf47734f185 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -68,11 +68,9 @@ #include #include -#include #include -#include "binder_alloc.h" #include "binder_internal.h" #include "binder_trace.h" @@ -160,24 +158,6 @@ module_param_call(stop_on_user_error, binder_set_stop_on_user_error, #define to_binder_fd_array_object(hdr) \ container_of(hdr, struct binder_fd_array_object, hdr) -enum binder_stat_types { - BINDER_STAT_PROC, - BINDER_STAT_THREAD, - BINDER_STAT_NODE, - BINDER_STAT_REF, - BINDER_STAT_DEATH, - BINDER_STAT_TRANSACTION, - BINDER_STAT_TRANSACTION_COMPLETE, - BINDER_STAT_COUNT -}; - -struct binder_stats { - atomic_t br[_IOC_NR(BR_FAILED_REPLY) + 1]; - atomic_t bc[_IOC_NR(BC_REPLY_SG) + 1]; - atomic_t obj_created[BINDER_STAT_COUNT]; - atomic_t obj_deleted[BINDER_STAT_COUNT]; -}; - static struct binder_stats binder_stats; static inline void binder_stats_deleted(enum binder_stat_types type) @@ -213,278 +193,11 @@ static struct binder_transaction_log_entry *binder_transaction_log_add( return e; } -/** - * struct binder_work - work enqueued on a worklist - * @entry: node enqueued on list - * @type: type of work to be performed - * - * There are separate work lists for proc, thread, and node (async). - */ -struct binder_work { - struct list_head entry; - - enum binder_work_type { - BINDER_WORK_TRANSACTION = 1, - BINDER_WORK_TRANSACTION_COMPLETE, - BINDER_WORK_RETURN_ERROR, - BINDER_WORK_NODE, - BINDER_WORK_DEAD_BINDER, - BINDER_WORK_DEAD_BINDER_AND_CLEAR, - BINDER_WORK_CLEAR_DEATH_NOTIFICATION, - } type; -}; - -struct binder_error { - struct binder_work work; - uint32_t cmd; -}; - -/** - * struct binder_node - binder node bookkeeping - * @debug_id: unique ID for debugging - * (invariant after initialized) - * @lock: lock for node fields - * @work: worklist element for node work - * (protected by @proc->inner_lock) - * @rb_node: element for proc->nodes tree - * (protected by @proc->inner_lock) - * @dead_node: element for binder_dead_nodes list - * (protected by binder_dead_nodes_lock) - * @proc: binder_proc that owns this node - * (invariant after initialized) - * @refs: list of references on this node - * (protected by @lock) - * @internal_strong_refs: used to take strong references when - * initiating a transaction - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @local_weak_refs: weak user refs from local process - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @local_strong_refs: strong user refs from local process - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @tmp_refs: temporary kernel refs - * (protected by @proc->inner_lock while @proc - * is valid, and by binder_dead_nodes_lock - * if @proc is NULL. During inc/dec and node release - * it is also protected by @lock to provide safety - * as the node dies and @proc becomes NULL) - * @ptr: userspace pointer for node - * (invariant, no lock needed) - * @cookie: userspace cookie for node - * (invariant, no lock needed) - * @has_strong_ref: userspace notified of strong ref - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @pending_strong_ref: userspace has acked notification of strong ref - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @has_weak_ref: userspace notified of weak ref - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @pending_weak_ref: userspace has acked notification of weak ref - * (protected by @proc->inner_lock if @proc - * and by @lock) - * @has_async_transaction: async transaction to node in progress - * (protected by @lock) - * @accept_fds: file descriptor operations supported for node - * (invariant after initialized) - * @min_priority: minimum scheduling priority - * (invariant after initialized) - * @txn_security_ctx: require sender's security context - * (invariant after initialized) - * @async_todo: list of async work items - * (protected by @proc->inner_lock) - * - * Bookkeeping structure for binder nodes. - */ -struct binder_node { - int debug_id; - spinlock_t lock; - struct binder_work work; - union { - struct rb_node rb_node; - struct hlist_node dead_node; - }; - struct binder_proc *proc; - struct hlist_head refs; - int internal_strong_refs; - int local_weak_refs; - int local_strong_refs; - int tmp_refs; - binder_uintptr_t ptr; - binder_uintptr_t cookie; - struct { - /* - * bitfield elements protected by - * proc inner_lock - */ - u8 has_strong_ref:1; - u8 pending_strong_ref:1; - u8 has_weak_ref:1; - u8 pending_weak_ref:1; - }; - struct { - /* - * invariant after initialization - */ - u8 accept_fds:1; - u8 txn_security_ctx:1; - u8 min_priority; - }; - bool has_async_transaction; - struct list_head async_todo; -}; - -struct binder_ref_death { - /** - * @work: worklist element for death notifications - * (protected by inner_lock of the proc that - * this ref belongs to) - */ - struct binder_work work; - binder_uintptr_t cookie; -}; - -/** - * struct binder_ref_data - binder_ref counts and id - * @debug_id: unique ID for the ref - * @desc: unique userspace handle for ref - * @strong: strong ref count (debugging only if not locked) - * @weak: weak ref count (debugging only if not locked) - * - * Structure to hold ref count and ref id information. Since - * the actual ref can only be accessed with a lock, this structure - * is used to return information about the ref to callers of - * ref inc/dec functions. - */ -struct binder_ref_data { - int debug_id; - uint32_t desc; - int strong; - int weak; -}; - -/** - * struct binder_ref - struct to track references on nodes - * @data: binder_ref_data containing id, handle, and current refcounts - * @rb_node_desc: node for lookup by @data.desc in proc's rb_tree - * @rb_node_node: node for lookup by @node in proc's rb_tree - * @node_entry: list entry for node->refs list in target node - * (protected by @node->lock) - * @proc: binder_proc containing ref - * @node: binder_node of target node. When cleaning up a - * ref for deletion in binder_cleanup_ref, a non-NULL - * @node indicates the node must be freed - * @death: pointer to death notification (ref_death) if requested - * (protected by @node->lock) - * - * Structure to track references from procA to target node (on procB). This - * structure is unsafe to access without holding @proc->outer_lock. - */ -struct binder_ref { - /* Lookups needed: */ - /* node + proc => ref (transaction) */ - /* desc + proc => ref (transaction, inc/dec ref) */ - /* node => refs + procs (proc exit) */ - struct binder_ref_data data; - struct rb_node rb_node_desc; - struct rb_node rb_node_node; - struct hlist_node node_entry; - struct binder_proc *proc; - struct binder_node *node; - struct binder_ref_death *death; -}; - enum binder_deferred_state { BINDER_DEFERRED_FLUSH = 0x01, BINDER_DEFERRED_RELEASE = 0x02, }; -/** - * struct binder_proc - binder process bookkeeping - * @proc_node: element for binder_procs list - * @threads: rbtree of binder_threads in this proc - * (protected by @inner_lock) - * @nodes: rbtree of binder nodes associated with - * this proc ordered by node->ptr - * (protected by @inner_lock) - * @refs_by_desc: rbtree of refs ordered by ref->desc - * (protected by @outer_lock) - * @r