[PATCH] dma-buf/sync_file: Use fdget()
From: Ye Xingchen convert the fget() use to fdget(). Signed-off-by: Ye Xingchen --- drivers/dma-buf/sync_file.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma-buf/sync_file.c b/drivers/dma-buf/sync_file.c index af57799c86ce..222b13b1bdb8 100644 --- a/drivers/dma-buf/sync_file.c +++ b/drivers/dma-buf/sync_file.c @@ -78,18 +78,18 @@ EXPORT_SYMBOL(sync_file_create); static struct sync_file *sync_file_fdget(int fd) { - struct file *file = fget(fd); + struct struct fd f = fdget(fd); - if (!file) + if (!f.file) return NULL; - if (file->f_op != _file_fops) + if (f.file->f_op != _file_fops) goto err; - return file->private_data; + return f.file->private_data; err: - fput(file); + fdput(f); return NULL; } -- 2.25.1
[PATCH] dma-buf: Use fdget()
From: Ye Xingchen convert the fget() use to fdget(). Signed-off-by: Ye Xingchen --- drivers/dma-buf/dma-buf.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index aa4ea8530cb3..bf4980b6f80c 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -729,19 +729,17 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_fd, DMA_BUF); */ struct dma_buf *dma_buf_get(int fd) { - struct file *file; - - file = fget(fd); + struct fd f = fdget(fd); - if (!file) + if (!f.file) return ERR_PTR(-EBADF); - if (!is_dma_buf_file(file)) { - fput(file); + if (!is_dma_buf_file(f.file)) { + fdput(f); return ERR_PTR(-EINVAL); } - return file->private_data; + return f.file->private_data; } EXPORT_SYMBOL_NS_GPL(dma_buf_get, DMA_BUF); -- 2.25.
[PATCH] drm: xlnx: zynqmp: Use dev_err_probe()
From: Ye Xingchen Replace the open-code with dev_err_probe() to simplify the code. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/xlnx/zynqmp_dp.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xlnx/zynqmp_dp.c b/drivers/gpu/drm/xlnx/zynqmp_dp.c index 0a7b466446fb..c6c2cb4626b9 100644 --- a/drivers/gpu/drm/xlnx/zynqmp_dp.c +++ b/drivers/gpu/drm/xlnx/zynqmp_dp.c @@ -1700,10 +1700,8 @@ int zynqmp_dp_probe(struct zynqmp_dpsub *dpsub) dp->reset = devm_reset_control_get(dp->dev, NULL); if (IS_ERR(dp->reset)) { - if (PTR_ERR(dp->reset) != -EPROBE_DEFER) - dev_err(dp->dev, "failed to get reset: %ld\n", - PTR_ERR(dp->reset)); - ret = PTR_ERR(dp->reset); + ret = dev_err_probe(dp->dev, PTR_ERR(dp->reset), + "failed to get reset: %ld\n"); goto err_free; } -- 2.25.1
[PATCH] drm/tegra: dpaux: Use dev_err_probe()
From: Ye Xingchen Replace the open-code with dev_err_probe() to simplify the code. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/tegra/dpaux.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 3c84e73d5051..6a3a6589a4d6 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -503,14 +503,9 @@ static int tegra_dpaux_probe(struct platform_device *pdev) dpaux->vdd = devm_regulator_get_optional(>dev, "vdd"); if (IS_ERR(dpaux->vdd)) { - if (PTR_ERR(dpaux->vdd) != -ENODEV) { - if (PTR_ERR(dpaux->vdd) != -EPROBE_DEFER) - dev_err(>dev, - "failed to get VDD supply: %ld\n", - PTR_ERR(dpaux->vdd)); - - return PTR_ERR(dpaux->vdd); - } + if (PTR_ERR(dpaux->vdd) != -ENODEV) + return dev_err_probe(>dev, PTR_ERR(dpaux->vdd), +"failed to get VDD supply: %ld\n"); dpaux->vdd = NULL; } -- 2.25.1
[PATCH] drm: bridge: simple-bridge: Use dev_err_probe()
From: Ye Xingchen Replace the open-code with dev_err_probe() to simplify the code. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/bridge/simple-bridge.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/simple-bridge.c b/drivers/gpu/drm/bridge/simple-bridge.c index 5ede3e111096..d85d9ee463b8 100644 --- a/drivers/gpu/drm/bridge/simple-bridge.c +++ b/drivers/gpu/drm/bridge/simple-bridge.c @@ -202,11 +202,9 @@ static int simple_bridge_probe(struct platform_device *pdev) sbridge->enable = devm_gpiod_get_optional(>dev, "enable", GPIOD_OUT_LOW); - if (IS_ERR(sbridge->enable)) { - if (PTR_ERR(sbridge->enable) != -EPROBE_DEFER) - dev_err(>dev, "Unable to retrieve enable GPIO\n"); - return PTR_ERR(sbridge->enable); - } + if (IS_ERR(sbridge->enable)) + return dev_err_probe(>dev, PTR_ERR(sbridge->enable), +"Unable to retrieve enable GPIO\n"); /* Register the bridge. */ sbridge->bridge.funcs = _bridge_bridge_funcs; -- 2.25.1
[PATCH] drm/bridge: display-connector: Use dev_err_probe()
From: Ye Xingchen Replace the open-code with dev_err_probe() to simplify the code. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/bridge/display-connector.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/display-connector.c b/drivers/gpu/drm/bridge/display-connector.c index fbb3e102c02f..56ae511367b1 100644 --- a/drivers/gpu/drm/bridge/display-connector.c +++ b/drivers/gpu/drm/bridge/display-connector.c @@ -271,12 +271,9 @@ static int display_connector_probe(struct platform_device *pdev) type == DRM_MODE_CONNECTOR_DisplayPort) { conn->hpd_gpio = devm_gpiod_get_optional(>dev, "hpd", GPIOD_IN); - if (IS_ERR(conn->hpd_gpio)) { - if (PTR_ERR(conn->hpd_gpio) != -EPROBE_DEFER) - dev_err(>dev, - "Unable to retrieve HPD GPIO\n"); - return PTR_ERR(conn->hpd_gpio); - } + if (IS_ERR(conn->hpd_gpio)) + return dev_err_probe(>dev, PTR_ERR(conn->hpd_gpio), +"Unable to retrieve HPD GPIO\n"); conn->hpd_irq = gpiod_to_irq(conn->hpd_gpio); } else { -- 2.25.1
[PATCH] drm: omapdrm: use devm_platform_ioremap_resource_byname()
From: Ye Xingchen Convert platform_get_resource_byname(),devm_ioremap_resource() to a single call to devm_platform_ioremap_resource_byname(), as this is exactly what this function does. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/omapdrm/dss/hdmi_wp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c index 9d830584a762..77a7aa797ad0 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi_wp.c @@ -280,8 +280,7 @@ int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp, { struct resource *res; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wp"); - wp->base = devm_ioremap_resource(>dev, res); + wp->base = devm_platform_ioremap_resource_byname(pdev, "wp"); if (IS_ERR(wp->base)) return PTR_ERR(wp->base); -- 2.25.1
[PATCH v2] drm/amd/display: remove duplicate include header
From: Ye Xingchen link_hwss.h is included more than once in link_dpms.c . Signed-off-by: Ye Xingchen --- v1 -> v2 Fix the U+00A0 non-breaking space in the subject line. drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c index 9cdfa7f7dc77..0c26b3589608 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c @@ -51,7 +51,6 @@ #include "link_enc_cfg.h" #include "resource.h" #include "dsc.h" -#include "link_hwss.h" #include "dccg.h" #include "clk_mgr.h" #include "atomfirmware.h" -- 2.25.1
[PATCH] drm/amdgpu/display: remove duplicate include header in link_dpms.c
From: Ye Xingchen link_hwss.h is included more than once. Signed-off-by: Ye Xingchen --- drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c index 9cdfa7f7dc77..0c26b3589608 100644 --- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c @@ -51,7 +51,6 @@ #include "link_enc_cfg.h" #include "resource.h" #include "dsc.h" -#include "link_hwss.h" #include "dccg.h" #include "clk_mgr.h" #include "atomfirmware.h" -- 2.25.1
[PATCH] gpu: ipu-v3: prg: use devm_platform_get_and_ioremap_resource()
From: Ye Xingchen Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Ye Xingchen --- drivers/gpu/ipu-v3/ipu-prg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-prg.c b/drivers/gpu/ipu-v3/ipu-prg.c index 196797c1b4b3..3e888c5f62d3 100644 --- a/drivers/gpu/ipu-v3/ipu-prg.c +++ b/drivers/gpu/ipu-v3/ipu-prg.c @@ -358,7 +358,6 @@ EXPORT_SYMBOL_GPL(ipu_prg_channel_configure_pending); static int ipu_prg_probe(struct platform_device *pdev) { struct device *dev = >dev; - struct resource *res; struct ipu_prg *prg; u32 val; int i, ret; @@ -367,8 +366,7 @@ static int ipu_prg_probe(struct platform_device *pdev) if (!prg) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - prg->regs = devm_ioremap_resource(>dev, res); + prg->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(prg->regs)) return PTR_ERR(prg->regs); -- 2.25.1
[PATCH] gpu: ipu-v3: pre: use devm_platform_get_and_ioremap_resource()
From: Ye Xingchen Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Ye Xingchen --- drivers/gpu/ipu-v3/ipu-pre.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-pre.c b/drivers/gpu/ipu-v3/ipu-pre.c index ad82c9e0252f..04229c7852a5 100644 --- a/drivers/gpu/ipu-v3/ipu-pre.c +++ b/drivers/gpu/ipu-v3/ipu-pre.c @@ -271,15 +271,13 @@ u32 ipu_pre_get_baddr(struct ipu_pre *pre) static int ipu_pre_probe(struct platform_device *pdev) { struct device *dev = >dev; - struct resource *res; struct ipu_pre *pre; pre = devm_kzalloc(dev, sizeof(*pre), GFP_KERNEL); if (!pre) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - pre->regs = devm_ioremap_resource(>dev, res); + pre->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(pre->regs)) return PTR_ERR(pre->regs); -- 2.25.1
[PATCH] gpu: host1x: mipi: use devm_platform_get_and_ioremap_resource()
From: Ye Xingchen Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Ye Xingchen --- drivers/gpu/host1x/mipi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c index 2efe12dde8bc..4dcec535ec21 100644 --- a/drivers/gpu/host1x/mipi.c +++ b/drivers/gpu/host1x/mipi.c @@ -501,7 +501,6 @@ static int tegra_mipi_probe(struct platform_device *pdev) { const struct of_device_id *match; struct tegra_mipi *mipi; - struct resource *res; int err; match = of_match_node(tegra_mipi_of_match, pdev->dev.of_node); @@ -515,8 +514,7 @@ static int tegra_mipi_probe(struct platform_device *pdev) mipi->soc = match->data; mipi->dev = >dev; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - mipi->regs = devm_ioremap_resource(>dev, res); + mipi->regs = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(mipi->regs)) return PTR_ERR(mipi->regs); -- 2.25.1
[PATCH] drm/amdgpu/display: remove duplicate include header in files
From: ye xingchen opp.h is included more than once. Signed-off-by: ye xingchen --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 6475664baa8a..1a2ab934b4bd 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -46,7 +46,6 @@ #include "dpcd_defs.h" #include "dmcu.h" #include "dsc.h" -#include "opp.h" #include "hw/clk_mgr.h" #include "dce/dmub_psr.h" #include "dmub/dmub_srv.h" -- 2.25.1
[PATCH] drm: bridge: Use devm_platform_get_and_ioremap_resource()
From: ye xingchen Convert platform_get_resource(), devm_ioremap_resource() to a single call to devm_platform_get_and_ioremap_resource(), as this is exactly what this function does. Signed-off-by: ye xingchen --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index df9370e0ff23..50f092b316d0 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1686,7 +1686,6 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) { struct platform_device *pdev = to_platform_device(dev); struct analogix_dp_device *dp; - struct resource *res; unsigned int irq_flags; int ret; @@ -1740,9 +1739,7 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data) clk_prepare_enable(dp->clock); - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - dp->reg_base = devm_ioremap_resource(>dev, res); + dp->reg_base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); if (IS_ERR(dp->reg_base)) { ret = PTR_ERR(dp->reg_base); goto err_disable_clk; -- 2.25.1
[PATCH] drm/bridge: Remove compilation error
From: ye xingchen drivers/gpu/drm/vc4/vc4_dsi.c :1822:13: error: 'struct drm_bridge' has no member named 'of_node'. Signed-off-by: ye xingchen --- include/drm/drm_bridge.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 42f86327b40a..1f84a8d491c7 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -715,10 +715,8 @@ struct drm_bridge { struct drm_encoder *encoder; /** @chain_node: used to form a bridge chain */ struct list_head chain_node; -#ifdef CONFIG_OF /** @of_node: device node pointer to the bridge */ struct device_node *of_node; -#endif /** @list: to keep track of all added bridges */ struct list_head list; /** -- 2.25.1
[PATCH] drm/amd/display: remove duplicate included header files
From: ye xingchen resource.h is included more than once. Signed-off-by: ye xingchen --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c index 1e60827911c6..6747e4b199de 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -47,7 +47,6 @@ #include "link/link_dp_training_auxless.h" #include "link/link_dp_phy.h" #include "link/link_dp_capability.h" -#include "resource.h" #define DC_LOGGER \ link->ctx->logger -- 2.25.1
[PATCH linux-next v3] fbdev: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- v2 -> v3 Fix the mistakes in v2. drivers/video/fbdev/sh_mobile_lcdcfb.c | 8 drivers/video/fbdev/uvesafb.c | 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 6d00893d41f4..ad9323ed8e2e 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1188,7 +1188,7 @@ overlay_alpha_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha); + return sysfs_emit(buf, "%u\n", ovl->alpha); } static ssize_t @@ -1226,7 +1226,7 @@ overlay_mode_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode); + return sysfs_emit(buf, "%u\n", ovl->mode); } static ssize_t @@ -1265,7 +1265,7 @@ overlay_position_show(struct device *dev, struct device_attribute *attr, struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y); + return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y); } static ssize_t @@ -1306,7 +1306,7 @@ overlay_rop3_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3); + return sysfs_emit(buf, "%u\n", ovl->rop3); } static ssize_t diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c index 00d789b6c0fa..ba8028a0cc7a 100644 --- a/drivers/video/fbdev/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c @@ -1580,7 +1580,7 @@ static ssize_t uvesafb_show_vendor(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_vendor_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_vendor_name_ptr); else return 0; @@ -1595,7 +1595,7 @@ static ssize_t uvesafb_show_product_name(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_product_name_ptr); else return 0; @@ -1610,7 +1610,7 @@ static ssize_t uvesafb_show_product_rev(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_rev_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_product_rev_ptr); else return 0; @@ -1625,7 +1625,7 @@ static ssize_t uvesafb_show_oem_string(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_string_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", + return sysfs_emit(buf, "%s\n", (char *)(>vbe_ib) + par->vbe_ib.oem_string_ptr); else return 0; @@ -1639,7 +1639,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev, struct fb_info *info = dev_get_drvdata(dev); struct uvesafb_par *par = info->par; - return scnprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc); + return sysfs_emit(buf, "%d\n", par->nocrtc); } static ssize_t uvesafb_store_nocrtc(struct device *dev, -- 2.25.1
[PATCH linux-next v2] fbdev: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- v1 -> v2 Add another patch about this in ./video/fbdev/ drivers/video/fbdev/sh_mobile_lcdcfb.c | 8 drivers/video/fbdev/uvesafb.c | 10 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 6d00893d41f4..ad9323ed8e2e 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1188,7 +1188,7 @@ overlay_alpha_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha); + return sysfs_emit(buf, "%u\n", ovl->alpha); } static ssize_t @@ -1226,7 +1226,7 @@ overlay_mode_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode); + return sysfs_emit(buf, "%u\n", ovl->mode); } static ssize_t @@ -1265,7 +1265,7 @@ overlay_position_show(struct device *dev, struct device_attribute *attr, struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y); + return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y); } static ssize_t @@ -1306,7 +1306,7 @@ overlay_rop3_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3); + return sysfs_emit(buf, "%u\n", ovl->rop3); } static ssize_t diff --git a/drivers/video/fbdev/uvesafb.c b/drivers/video/fbdev/uvesafb.c index 00d789b6c0fa..ba8028a0cc7a 100644 --- a/drivers/video/fbdev/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c @@ -1580,7 +1580,7 @@ static ssize_t uvesafb_show_vendor(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_vendor_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_vendor_name_ptr); else return 0; @@ -1595,7 +1595,7 @@ static ssize_t uvesafb_show_product_name(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_name_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_product_name_ptr); else return 0; @@ -1610,7 +1610,7 @@ static ssize_t uvesafb_show_product_rev(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_product_rev_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", (char *) + return sysfs_emit(buf, "%s\n", (char *) (>vbe_ib) + par->vbe_ib.oem_product_rev_ptr); else return 0; @@ -1625,7 +1625,7 @@ static ssize_t uvesafb_show_oem_string(struct device *dev, struct uvesafb_par *par = info->par; if (par->vbe_ib.oem_string_ptr) - return scnprintf(buf, PAGE_SIZE, "%s\n", + return sysfs_emit(buf, "%s\n", (char *)(>vbe_ib) + par->vbe_ib.oem_string_ptr); else return 0; @@ -1639,7 +1639,7 @@ static ssize_t uvesafb_show_nocrtc(struct device *dev, struct fb_info *info = dev_get_drvdata(dev); struct uvesafb_par *par = info->par; - return scnprintf(buf, PAGE_SIZE, "%d\n", par->nocrtc); + return sysfs_emit(buf, "%d\n", par->nocrtc); } static ssize_t uvesafb_store_nocrtc(struct device *dev, -- 2.25.1
[PATCH linux-next] fbdev: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- drivers/video/fbdev/sh_mobile_lcdcfb.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/sh_mobile_lcdcfb.c b/drivers/video/fbdev/sh_mobile_lcdcfb.c index 6d00893d41f4..ad9323ed8e2e 100644 --- a/drivers/video/fbdev/sh_mobile_lcdcfb.c +++ b/drivers/video/fbdev/sh_mobile_lcdcfb.c @@ -1188,7 +1188,7 @@ overlay_alpha_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->alpha); + return sysfs_emit(buf, "%u\n", ovl->alpha); } static ssize_t @@ -1226,7 +1226,7 @@ overlay_mode_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->mode); + return sysfs_emit(buf, "%u\n", ovl->mode); } static ssize_t @@ -1265,7 +1265,7 @@ overlay_position_show(struct device *dev, struct device_attribute *attr, struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%d,%d\n", ovl->pos_x, ovl->pos_y); + return sysfs_emit(buf, "%d,%d\n", ovl->pos_x, ovl->pos_y); } static ssize_t @@ -1306,7 +1306,7 @@ overlay_rop3_show(struct device *dev, struct device_attribute *attr, char *buf) struct fb_info *info = dev_get_drvdata(dev); struct sh_mobile_lcdc_overlay *ovl = info->par; - return scnprintf(buf, PAGE_SIZE, "%u\n", ovl->rop3); + return sysfs_emit(buf, "%u\n", ovl->rop3); } static ssize_t -- 2.25.1
[PATCH linux-next] backlight: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Follow the advice of the Documentation/filesystems/sysfs.rst and show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. Signed-off-by: ye xingchen --- drivers/video/backlight/lm3533_bl.c | 10 +- drivers/video/backlight/lp855x_bl.c | 4 ++-- drivers/video/backlight/lp8788_bl.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index 1df1b6643c0b..5e2ce9285245 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -66,7 +66,7 @@ static ssize_t show_id(struct device *dev, { struct lm3533_bl *bl = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%d\n", bl->id); + return sysfs_emit(buf, "%d\n", bl->id); } static ssize_t show_als_channel(struct device *dev, @@ -75,7 +75,7 @@ static ssize_t show_als_channel(struct device *dev, struct lm3533_bl *bl = dev_get_drvdata(dev); unsigned channel = lm3533_bl_get_ctrlbank_id(bl); - return scnprintf(buf, PAGE_SIZE, "%u\n", channel); + return sysfs_emit(buf, "%u\n", channel); } static ssize_t show_als_en(struct device *dev, @@ -95,7 +95,7 @@ static ssize_t show_als_en(struct device *dev, mask = 1 << (2 * ctrlbank); enable = val & mask; - return scnprintf(buf, PAGE_SIZE, "%d\n", enable); + return sysfs_emit(buf, "%d\n", enable); } static ssize_t store_als_en(struct device *dev, @@ -147,7 +147,7 @@ static ssize_t show_linear(struct device *dev, else linear = 0; - return scnprintf(buf, PAGE_SIZE, "%x\n", linear); + return sysfs_emit(buf, "%x\n", linear); } static ssize_t store_linear(struct device *dev, @@ -190,7 +190,7 @@ static ssize_t show_pwm(struct device *dev, if (ret) return ret; - return scnprintf(buf, PAGE_SIZE, "%u\n", val); + return sysfs_emit(buf, "%u\n", val); } static ssize_t store_pwm(struct device *dev, diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index bd0bdeae23a4..fafc1a9e76ef 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -293,7 +293,7 @@ static ssize_t lp855x_get_chip_id(struct device *dev, { struct lp855x *lp = dev_get_drvdata(dev); - return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname); + return sysfs_emit(buf, "%s\n", lp->chipname); } static ssize_t lp855x_get_bl_ctl_mode(struct device *dev, @@ -307,7 +307,7 @@ static ssize_t lp855x_get_bl_ctl_mode(struct device *dev, else if (lp->mode == REGISTER_BASED) strmode = "register based"; - return scnprintf(buf, PAGE_SIZE, "%s\n", strmode); + return sysfs_emit(buf, "%s\n", strmode); } static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL); diff --git a/drivers/video/backlight/lp8788_bl.c b/drivers/video/backlight/lp8788_bl.c index ba42f3fe0c73..00d79c0cfee9 100644 --- a/drivers/video/backlight/lp8788_bl.c +++ b/drivers/video/backlight/lp8788_bl.c @@ -240,7 +240,7 @@ static ssize_t lp8788_get_bl_ctl_mode(struct device *dev, else strmode = "Invalid mode"; - return scnprintf(buf, PAGE_SIZE, "%s\n", strmode); + return sysfs_emit(buf, "%s\n", strmode); } static DEVICE_ATTR(bl_ctl_mode, S_IRUGO, lp8788_get_bl_ctl_mode, NULL); -- 2.25.1
[PATCH] drm/i915: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/gpu/drm/i915/i915_mitigations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_mitigations.c b/drivers/gpu/drm/i915/i915_mitigations.c index def7302ef7fe..2b7aaaefb3a9 100644 --- a/drivers/gpu/drm/i915/i915_mitigations.c +++ b/drivers/gpu/drm/i915/i915_mitigations.c @@ -102,10 +102,10 @@ static int mitigations_get(char *buffer, const struct kernel_param *kp) bool enable; if (!local) - return scnprintf(buffer, PAGE_SIZE, "%s\n", "off"); + return sysfs_emit(buffer, "%s\n", "off"); if (local & BIT(BITS_PER_LONG - 1)) { - count = scnprintf(buffer, PAGE_SIZE, "%s,", "auto"); + count = sysfs_emit(buffer, "%s,", "auto"); enable = false; } else { enable = true; -- 2.25.1
[PATCH] drm/amdgpu: use sysfs_emit() to instead of scnprintf()
From: ye xingchen Replace the open-code with sysfs_emit() to simplify the code. Signed-off-by: ye xingchen --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 077404a9c935..ad490c1e2f57 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -1267,7 +1267,7 @@ static ssize_t amdgpu_ras_sysfs_features_read(struct device *dev, struct amdgpu_ras *con = container_of(attr, struct amdgpu_ras, features_attr); - return scnprintf(buf, PAGE_SIZE, "feature mask: 0x%x\n", con->features); + return sysfs_emit(buf, "feature mask: 0x%x\n", con->features); } static void amdgpu_ras_sysfs_remove_bad_page_node(struct amdgpu_device *adev) -- 2.25.1
[PATCH linux-next] drm/panel: Use device_match_of_node()
From: ye xingchen Replace the open-code with device_match_of_node(). Signed-off-by: ye xingchen --- drivers/gpu/drm/drm_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index f634371c717a..ba66ac1ad88a 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -250,7 +250,7 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np) mutex_lock(_lock); list_for_each_entry(panel, _list, list) { - if (panel->dev->of_node == np) { + if (device_match_of_node(panel->dev, np)) { mutex_unlock(_lock); return panel; } -- 2.25.1
[PATCH linux-next] drm/imx: Use device_match_of_node()
From: ye xingchen Replace the open-code with device_match_of_node(). Signed-off-by: ye xingchen --- drivers/gpu/drm/imx/imx-drm-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index e060fa6cbcb9..2e4f5af894b0 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c @@ -182,7 +182,7 @@ static int compare_of(struct device *dev, void *data) if (strcmp(dev->driver->name, "imx-ipuv3-crtc") == 0) { struct ipu_client_platformdata *pdata = dev->platform_data; - return pdata->of_node == np; + return device_match_of_node(pdata, np); } /* Special case for LDB, one device for two channels */ @@ -191,7 +191,7 @@ static int compare_of(struct device *dev, void *data) of_node_put(np); } - return dev->of_node == np; + return device_match_of_node(dev, np); } static int imx_drm_bind(struct device *dev) -- 2.25.1
[PATCH linux-next] drm/bridge: Use device_match_of_node()
From: ye xingchen Replace the open-code with device_match_of_node(). Signed-off-by: ye xingchen --- drivers/gpu/drm/drm_bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 1545c50fd1c8..4a8cafe2b130 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1307,7 +1307,7 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np) mutex_lock(_lock); list_for_each_entry(bridge, _list, list) { - if (bridge->of_node == np) { + if (device_match_of_node(bridge, np)) { mutex_unlock(_lock); return bridge; } -- 2.25.1