[Freedreno] [PATCH] gpu: Consistently use octal not symbolic permissions
There is currently a mixture of octal and symbolic permissions uses in files in drivers/gpu/drm and one file in drivers/gpu. There are ~270 existing octal uses and ~115 S_ uses. Convert all the S_ symbolic permissions to their octal equivalents as using octal and not symbolic permissions is preferred by many as more readable. see: https://lkml.org/lkml/2016/8/2/1945 Done with automated conversion via: $ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace Miscellanea: o Wrapped modified multi-line calls to a single line where appropriate o Realign modified multi-line calls to open parenthesis o drivers/gpu/drm/msm/adreno/a5xx_debugfs.c has a world-writeable debug permission for "reset" - perhaps that should be modified Signed-off-by: Joe Perches <j...@perches.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c| 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 98 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 9 +- drivers/gpu/drm/armada/armada_debugfs.c| 4 +- drivers/gpu/drm/drm_debugfs.c | 6 +- drivers/gpu/drm/drm_debugfs_crc.c | 4 +- drivers/gpu/drm/drm_sysfs.c| 2 +- drivers/gpu/drm/i915/gvt/firmware.c| 2 +- drivers/gpu/drm/i915/i915_debugfs.c| 8 +- drivers/gpu/drm/i915/i915_perf.c | 2 +- drivers/gpu/drm/i915/i915_sysfs.c | 22 ++--- drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- drivers/gpu/drm/msm/adreno/a5xx_debugfs.c | 5 +- drivers/gpu/drm/msm/msm_perf.c | 4 +- drivers/gpu/drm/msm/msm_rd.c | 4 +- drivers/gpu/drm/nouveau/nouveau_debugfs.c | 2 +- drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c| 11 ++- .../drm/omapdrm/displays/panel-sony-acx565akm.c| 6 +- .../drm/omapdrm/displays/panel-tpo-td043mtea1.c| 10 +-- drivers/gpu/drm/radeon/radeon_pm.c | 26 +++--- drivers/gpu/drm/radeon/radeon_ttm.c| 4 +- drivers/gpu/drm/sti/sti_drv.c | 2 +- drivers/gpu/drm/tinydrm/mipi-dbi.c | 4 +- drivers/gpu/drm/ttm/ttm_bo.c | 2 +- drivers/gpu/drm/ttm/ttm_memory.c | 12 +-- drivers/gpu/drm/ttm/ttm_page_alloc.c | 6 +- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +- drivers/gpu/drm/udl/udl_fb.c | 4 +- drivers/gpu/host1x/debug.c | 12 +-- 30 files changed, 138 insertions(+), 146 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c index f5fb93795a69..7b29febff511 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c @@ -830,7 +830,7 @@ int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) { ent = debugfs_create_file(debugfs_regs_names[i], - S_IFREG | S_IRUGO, root, + S_IFREG | 0444, root, adev, debugfs_regs[i]); if (IS_ERR(ent)) { for (j = 0; j < i; j++) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c index b455da487782..fa55d7e9e784 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c @@ -905,39 +905,39 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev, return -EINVAL; } -static DEVICE_ATTR(power_dpm_state, S_IRUGO | S_IWUSR, amdgpu_get_dpm_state, amdgpu_set_dpm_state); -static DEVICE_ATTR(power_dpm_force_performance_level, S_IRUGO | S_IWUSR, +static DEVICE_ATTR(power_dpm_state, 0644, amdgpu_get_dpm_state, amdgpu_set_dpm_state); +static DEVICE_ATTR(power_dpm_force_performance_level, 0644, amdgpu_get_dpm_forced_performance_level, amdgpu_set_dpm_forced_performance_level); -static DEVICE_ATTR(pp_num_states, S_IRUGO, amdgpu_get_pp_num_states, NULL); -static DEVICE_ATTR(pp_cur_state, S_IRUGO, amdgpu_get_pp_cur_state, NULL); -static DEVICE_ATTR(pp_force_state, S_IRUGO | S_IWUSR, - amdgpu_get_pp_force_state, - amdgpu_set_pp_force_state); -static DEVICE_ATTR(pp_table, S_IRUGO | S_IWUSR, - amdgpu_get_pp_table, - amdgpu_set_pp_table); -static DEVICE_ATTR(pp_dpm_sclk, S_IRUGO | S_IWUSR, - amdgpu_get_pp_dpm_sclk, - amdgpu_set_pp_dpm_sclk); -static DEVICE_ATTR(pp_dpm_mclk, S_IRUGO | S_IWUSR, - amdgpu_get_pp_dpm_mclk, - amdgpu_set_pp_dpm_mclk); -static DEVICE_ATTR(pp_dpm_pcie, S_IRUGO | S_IWUSR, -
Re: [Freedreno] [PATCH] gpu: Consistently use octal not symbolic permissions
On Fri, 2018-05-25 at 09:41 +0300, Jani Nikula wrote: > On Thu, 24 May 2018, Joe Perches <j...@perches.com> wrote: > > There is currently a mixture of octal and symbolic permissions uses > > in files in drivers/gpu/drm and one file in drivers/gpu. > > > > There are ~270 existing octal uses and ~115 S_ uses. > > > > Convert all the S_ symbolic permissions to their octal equivalents > > as using octal and not symbolic permissions is preferred by many as more > > readable. > > > > see: https://lkml.org/lkml/2016/8/2/1945 > > > > Done with automated conversion via: > > $ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace > > > > Miscellanea: > > > > o Wrapped modified multi-line calls to a single line where appropriate > > o Realign modified multi-line calls to open parenthesis > > o drivers/gpu/drm/msm/adreno/a5xx_debugfs.c has a world-writeable > > debug permission for "reset" - perhaps that should be modified > > Signed-off-by: Joe Perches <j...@perches.com> > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c| 2 +- > > drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 98 > > +++--- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 +- > > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c| 9 +- > > drivers/gpu/drm/armada/armada_debugfs.c| 4 +- > > drivers/gpu/drm/drm_debugfs.c | 6 +- > > drivers/gpu/drm/drm_debugfs_crc.c | 4 +- > > drivers/gpu/drm/drm_sysfs.c| 2 +- > > drivers/gpu/drm/i915/gvt/firmware.c| 2 +- > > drivers/gpu/drm/i915/i915_debugfs.c| 8 +- > > drivers/gpu/drm/i915/i915_perf.c | 2 +- > > drivers/gpu/drm/i915/i915_sysfs.c | 22 ++--- > > drivers/gpu/drm/i915/intel_pipe_crc.c | 2 +- > > Please send at least i915 changes separately. There's zero reason to > make our lives harder for this change. The idea is to avoid unnecessary multiple patches for individual trees. But you could do that via something like: $ git am --include='drivers/gpu/drm/i915/*' cheers, Joe ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
[Freedreno] [PATCH] drm/msm: Add __printf verification
Add a few __printf attribute specifiers to routines that could use them. Signed-off-by: Joe Perches --- drivers/gpu/drm/msm/msm_drv.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9f51be5a637c..927e5d86f7c1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -334,6 +334,7 @@ void msm_gem_kernel_put(struct drm_gem_object *bo, struct drm_gem_object *msm_gem_import(struct drm_device *dev, struct dma_buf *dmabuf, struct sg_table *sgt); +__printf(2, 3) void msm_gem_object_set_name(struct drm_gem_object *bo, const char *fmt, ...); int msm_framebuffer_prepare(struct drm_framebuffer *fb, @@ -397,12 +398,14 @@ void msm_framebuffer_describe(struct drm_framebuffer *fb, struct seq_file *m); int msm_debugfs_late_init(struct drm_device *dev); int msm_rd_debugfs_init(struct drm_minor *minor); void msm_rd_debugfs_cleanup(struct msm_drm_private *priv); +__printf(3, 4) void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, const char *fmt, ...); int msm_perf_debugfs_init(struct drm_minor *minor); void msm_perf_debugfs_cleanup(struct msm_drm_private *priv); #else static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; } +__printf(3, 4) static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit, const char *fmt, ...) {} static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {} ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
[Freedreno] [PATCH -next 000/491] treewide: use fallthrough;
There is a new fallthrough pseudo-keyword macro that can be used to replace the various /* fallthrough */ style comments that are used to indicate a case label code block is intended to fallthrough to the next case label block. See commit 294f69e662d1 ("compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use") These patches are intended to allow clang to detect missing switch/case fallthrough uses. Do a depth-first pass on the MAINTAINERS file and find the various F: pattern files and convert the fallthrough comments to fallthrough; for all files matched by all F: patterns in in each section. Done via the perl script below and the previously posted cvt_fallthrough.pl script. Link: https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git.joe.com/ These patches are based on next-20200310 and are available in git://repo.or.cz/linux-2.6/trivial-mods.git in branch 20200310_fallthrough_2 $ cat commit_fallthrough.pl #!/usr/bin/env perl use sort 'stable'; # # Reorder a sorted array so file entries are before directory entries # depends on a trailing / for directories # so: # foo/ # foo/bar.c # becomes # foo/bar.c # foo/ # sub file_before_directory { my ($array_ref) = (@_); my $count = scalar(@$array_ref); for (my $i = 1; $i < $count; $i++) { if (substr(@$array_ref[$i - 1], -1) eq '/' && substr(@$array_ref[$i], 0, length(@$array_ref[$i - 1])) eq @$array_ref[$i - 1]) { my $string = @$array_ref[$i - 1]; @$array_ref[$i - 1] = @$array_ref[$i]; @$array_ref[$i] = $string; } } } sub uniq { my (@parms) = @_; my %saw; @parms = grep(!$saw{$_}++, @parms); return @parms; } # Get all the F: file patterns in MAINTAINERS that could be a .[ch] file my $maintainer_patterns = `grep -P '^F:\\s+' MAINTAINERS`; my @patterns = split('\n', $maintainer_patterns); s/^F:\s*// for @patterns; @patterns = grep(!/^(?:Documentation|tools|scripts)\//, @patterns); @patterns = grep(!/\.(?:dtsi?|rst|config)$/, @patterns); @patterns = sort @patterns; @patterns = sort { $b =~ tr/\//\// cmp $a =~ tr/\//\// } @patterns; file_before_directory(\@patterns); my %sections_done; foreach my $pattern (@patterns) { # Find the files the pattern matches my $pattern_files = `git ls-files -- $pattern`; my @new_patterns = split('\n', $pattern_files); $pattern_files = join(' ', @new_patterns); next if ($pattern_files =~ /^\s*$/); # Find the section the first file matches my $pattern_file = @new_patterns[0]; my $section_output = `./scripts/get_maintainer.pl --nogit --nogit-fallback --sections --pattern-depth=1 $pattern_file`; my @section = split('\n', $section_output); my $section_header = @section[0]; print("Section: <$section_header>\n"); # Skip the section if it's already done print("Already done '$section_header'\n") if ($sections_done{$section_header}); next if ($sections_done{$section_header}++); # Find all the .[ch] files in all F: lines in that section my @new_section; foreach my $line (@section) { last if ($line =~ /^\s*$/); push(@new_section, $line); } @section = grep(/^F:/, @new_section); s/^F:\s*// for @section; @section = grep(!/^(?:Documentation|tools|scripts)\//, @section); @section = grep(!/\.(?:dtsi?|rst|config)$/, @section); @section = sort @section; @section = uniq(@section); my $section_files = join(' ', @section); print("section_files: <$section_files>\n"); next if ($section_files =~ /^\s*$/); my $cvt_files = `git ls-files -- $section_files`; my @files = split('\n', $cvt_files); @files = grep(!/^(?:Documentation|tools|scripts)\//, @files); @files = grep(!/\.(?:dtsi?|rst|config)$/, @files); @files = grep(/\.[ch]$/, @files); @files = sort @files; @files = uniq(@files); $cvt_files = join(' ', @files); print("files: <$cvt_files>\n"); next if (scalar(@files) < 1); # Convert fallthroughs for all [.ch] files in the section print("doing cvt_fallthrough.pl -- $cvt_files\n"); `cvt_fallthrough.pl -- $cvt_files`; # If nothing changed, nothing to commit `git diff-index --quiet HEAD --`; next if (!$?); # Commit the changes my $fh; open($fh, "+>", "cvt_fallthrough.commit_msg") or die "$0: can't create temporary file: $!\n"; print $fh <https://lore.kernel.org/lkml/b56602fcf79f849e733e7b521bb0e17895d390fa.1582230379.git@perches.com/ EOF ; close $fh; `git commit -s -a -F cvt_fallthrough.commit_msg`; } Joe Perches (491): MELLANOX ETHERNET INNOVA DRIVERS: Use fallthrough; MARVELL OCTEONTX2 RVU ADMIN FUNCTION DRIVER: Use fallthrough; MELLANOX MLX5 core VPI driver: Use fallthrough; PERFORMANCE EVENTS SUBSYSTEM: Use fallthrough; ARM/UNI
Re: [Freedreno] [PATCH] drm/msm/dp: Add a missing semi-colon
On Sat, 2021-02-06 at 20:18 -0800, Stephen Boyd wrote: > A missing semicolon here causes my external display to stop working. > Indeed, missing the semicolon on the return statement leads to > dp_panel_update_tu_timings() not existing because the compiler thinks > it's part of the return statement of a void function, so it must not be > important. > > $ ./scripts/bloat-o-meter before.o after.o > add/remove: 1/1 grow/shrink: 0/1 up/down: 7400/-7540 (-140) > Function old new delta > dp_panel_update_tu_timings -7400 +7400 > _dp_ctrl_calc_tu.constprop 18024 17900-124 > dp_panel_update_tu_timings.constprop7416 - -7416 > Total: Before=54440, After=54300, chg -0.26% > > Add a semicolon so this function works like it used to. [] > diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c > b/drivers/gpu/drm/msm/dp/dp_ctrl.c [] > @@ -631,7 +631,7 @@ static void _dp_ctrl_calc_tu(struct dp_tu_calc_input *in, > > > tu = kzalloc(sizeof(*tu), GFP_KERNEL); > if (!tu) > - return > + return; > > > dp_panel_update_tu_timings(in, tu); Wow, that's really unfortunate that dp_panel_update_tu_timings is also void. Perhaps this as YA checkpatch warning: --- scripts/checkpatch.pl | 6 ++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9a549b009d2f..6df13e5a1557 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3674,6 +3674,12 @@ sub process { } } +# check only a c90 keyword on the line (except else) + if ($sline =~ /^\+\s*($c90_Keywords)\s*$/ && $1 ne 'else') { + WARN("BARE_KEYWORD", +"'$1' as the only word on a line is not good style\n" . $herecurr); + } + # check multi-line statement indentation matches previous line if ($perl_version_ok && $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) { ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [PATCH] drm/msm/dp: Add a missing semi-colon
On Mon, 2021-02-08 at 10:57 -0800, Stephen Boyd wrote: > Quoting Joe Perches (2021-02-06 21:06:54) > > Wow, that's really unfortunate that dp_panel_update_tu_timings > > is also void. > > > > Perhaps this as YA checkpatch warning: > > > > --- > > Acked-by: Stephen Boyd Are you acking the proposed checkpatch patch? ___ Freedreno mailing list Freedreno@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/freedreno
Re: [Freedreno] [PATCH] MAINTAINERS: update designated reviewer entry for MSM DRM driver
On Fri, 2021-11-19 at 15:18 -0800, Abhinav Kumar wrote: > Adding myself as a designated reviewer to assist with the > code reviews for the changes coming into MSM DRM. > > Acked-by: Rob Clark > Signed-off-by: Abhinav Kumar [] > diff --git a/MAINTAINERS b/MAINTAINERS [] > @@ -5938,6 +5938,7 @@ M: Sean Paul > L: linux-arm-...@vger.kernel.org > L: dri-de...@lists.freedesktop.org > L: freedreno@lists.freedesktop.org > +R: Abhinav Kumar > S: Maintained > T: git https://gitlab.freedesktop.org/drm/msm.git > F: Documentation/devicetree/bindings/display/msm/ R: goes after M: not L:
Re: [Freedreno] [PATCH v3 4/4] drm/msm/adreno: Fix up formatting
On Sat, 2022-05-28 at 18:03 +0200, Konrad Dybcio wrote: > Leading spaces are not something checkpatch likes, and it says so when > they are present. Use tabs consistently to indent function body and > unwrap a 83-char-long line, as 100 is cool nowadays. unassociated trivia: > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h > b/drivers/gpu/drm/msm/adreno/adreno_gpu.h [] > @@ -199,7 +199,7 @@ static inline int adreno_is_a420(struct adreno_gpu *gpu) > > static inline int adreno_is_a430(struct adreno_gpu *gpu) > { > - return gpu->revn == 430; > + return gpu->revn == 430; > } looks like these could/should return bool > static inline int adreno_is_a506(struct adreno_gpu *gpu) > @@ -239,7 +239,7 @@ static inline int adreno_is_a540(struct adreno_gpu *gpu) > > static inline int adreno_is_a618(struct adreno_gpu *gpu) > { > - return gpu->revn == 618; > + return gpu->revn == 618; > } etc...