Skip to content

Commit 6395138

Browse files
committed
drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c
There's not really any value in stating that no locking is needed. And even if the comment is useful, a check for the right mutex at the beginning of the function is better since that can't be ingored as easily as a bit of documentation. Note that drm_mode_probed_add in drm_crtc.c is also changed, the next patch will move this into drm_modes.c v2: Don't add locking WARN_ONs where it is not strictly required (i.e. the two functions to validate/prune mode lists). Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 3ec0db8 commit 6395138

2 files changed

Lines changed: 4 additions & 57 deletions

File tree

‎drivers/gpu/drm/drm_crtc.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ EXPORT_SYMBOL(drm_crtc_index);
730730
void drm_mode_probed_add(struct drm_connector *connector,
731731
struct drm_display_mode *mode)
732732
{
733+
WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
734+
733735
list_add_tail(&mode->head, &connector->probed_modes);
734736
}
735737
EXPORT_SYMBOL(drm_mode_probed_add);

‎drivers/gpu/drm/drm_modes.c‎

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
* drm_mode_debug_printmodeline - print a mode to dmesg
4343
* @mode: mode to print
4444
*
45-
* LOCKING:
46-
* none.
47-
*
4845
* Describe @mode using DRM_DEBUG.
4946
*/
5047
void drm_mode_debug_printmodeline(const struct drm_display_mode *mode)
@@ -69,9 +66,6 @@ EXPORT_SYMBOL(drm_mode_debug_printmodeline);
6966
* @interlaced:Whether the interlace is supported
7067
* @margins: whether to add margins or not
7168
*
72-
* LOCKING:
73-
* none.
74-
*
7569
* return the modeline based on CVT algorithm
7670
*
7771
* This function is called to generate the modeline based on CVT algorithm
@@ -294,9 +288,6 @@ EXPORT_SYMBOL(drm_cvt_mode);
294288
* @GTF_K: extended GTF formula parameters
295289
* @GTF_2J: extended GTF formula parameters
296290
*
297-
* LOCKING.
298-
* none.
299-
*
300291
* return the modeline based on full GTF algorithm.
301292
*
302293
* GTF feature blocks specify C and J in multiples of 0.5, so we pass them
@@ -479,9 +470,6 @@ EXPORT_SYMBOL(drm_gtf_mode_complex);
479470
* @interlaced :whether the interlace is supported
480471
* @margins :whether the margin is supported
481472
*
482-
* LOCKING.
483-
* none.
484-
*
485473
* return the modeline based on GTF algorithm
486474
*
487475
* This function is to create the modeline based on the GTF algorithm.
@@ -584,9 +572,6 @@ EXPORT_SYMBOL_GPL(of_get_drm_display_mode);
584572
* drm_mode_set_name - set the name on a mode
585573
* @mode: name will be set in this mode
586574
*
587-
* LOCKING:
588-
* None.
589-
*
590575
* Set the name of @mode to a standard format.
591576
*/
592577
void drm_mode_set_name(struct drm_display_mode *mode)
@@ -603,9 +588,6 @@ EXPORT_SYMBOL(drm_mode_set_name);
603588
* drm_mode_width - get the width of a mode
604589
* @mode: mode
605590
*
606-
* LOCKING:
607-
* None.
608-
*
609591
* Return @mode's width (hdisplay) value.
610592
*
611593
* FIXME: is this needed?
@@ -624,9 +606,6 @@ EXPORT_SYMBOL(drm_mode_width);
624606
* drm_mode_height - get the height of a mode
625607
* @mode: mode
626608
*
627-
* LOCKING:
628-
* None.
629-
*
630609
* Return @mode's height (vdisplay) value.
631610
*
632611
* FIXME: is this needed?
@@ -643,9 +622,6 @@ EXPORT_SYMBOL(drm_mode_height);
643622
/** drm_mode_hsync - get the hsync of a mode
644623
* @mode: mode
645624
*
646-
* LOCKING:
647-
* None.
648-
*
649625
* Return @modes's hsync rate in kHz, rounded to the nearest int.
650626
*/
651627
int drm_mode_hsync(const struct drm_display_mode *mode)
@@ -670,9 +646,6 @@ EXPORT_SYMBOL(drm_mode_hsync);
670646
* drm_mode_vrefresh - get the vrefresh of a mode
671647
* @mode: mode
672648
*
673-
* LOCKING:
674-
* None.
675-
*
676649
* Return @mode's vrefresh rate in Hz or calculate it if necessary.
677650
*
678651
* FIXME: why is this needed? shouldn't vrefresh be set already?
@@ -713,9 +686,6 @@ EXPORT_SYMBOL(drm_mode_vrefresh);
713686
* @p: mode
714687
* @adjust_flags: a combination of adjustment flags
715688
*
716-
* LOCKING:
717-
* None.
718-
*
719689
* Setup the CRTC modesetting parameters for @p, adjusting if necessary.
720690
*
721691
* - The CRTC_INTERLACE_HALVE_V flag can be used to halve vertical timings of
@@ -790,9 +760,6 @@ EXPORT_SYMBOL(drm_mode_set_crtcinfo);
790760
* @dst: mode to overwrite
791761
* @src: mode to copy
792762
*
793-
* LOCKING:
794-
* None.
795-
*
796763
* Copy an existing mode into another mode, preserving the object id and
797764
* list head of the destination mode.
798765
*/
@@ -812,9 +779,6 @@ EXPORT_SYMBOL(drm_mode_copy);
812779
* @dev: drm_device to allocate the duplicated mode for
813780
* @mode: mode to duplicate
814781
*
815-
* LOCKING:
816-
* None.
817-
*
818782
* Just allocate a new mode, copy the existing mode into it, and return
819783
* a pointer to it. Used to create new instances of established modes.
820784
*/
@@ -838,9 +802,6 @@ EXPORT_SYMBOL(drm_mode_duplicate);
838802
* @mode1: first mode
839803
* @mode2: second mode
840804
*
841-
* LOCKING:
842-
* None.
843-
*
844805
* Check to see if @mode1 and @mode2 are equivalent.
845806
*
846807
* RETURNS:
@@ -869,9 +830,6 @@ EXPORT_SYMBOL(drm_mode_equal);
869830
* @mode1: first mode
870831
* @mode2: second mode
871832
*
872-
* LOCKING:
873-
* None.
874-
*
875833
* Check to see if @mode1 and @mode2 are equivalent, but
876834
* don't check the pixel clocks nor the stereo layout.
877835
*
@@ -907,9 +865,6 @@ EXPORT_SYMBOL(drm_mode_equal_no_clocks_no_stereo);
907865
* @maxY: maximum height
908866
* @maxPitch: max pitch
909867
*
910-
* LOCKING:
911-
* Caller must hold a lock protecting @mode_list.
912-
*
913868
* The DRM device (@dev) has size and pitch limits. Here we validate the
914869
* modes we probed for @dev against those limits and set their status as
915870
* necessary.
@@ -939,9 +894,6 @@ EXPORT_SYMBOL(drm_mode_validate_size);
939894
* @mode_list: list of modes to check
940895
* @verbose: be verbose about it
941896
*
942-
* LOCKING:
943-
* Caller must hold a lock protecting @mode_list.
944-
*
945897
* Once mode list generation is complete, a caller can use this routine to
946898
* remove invalid modes from a mode list. If any of the modes have a
947899
* status other than %MODE_OK, they are removed from @mode_list and freed.
@@ -971,9 +923,6 @@ EXPORT_SYMBOL(drm_mode_prune_invalid);
971923
* @lh_a: list_head for first mode
972924
* @lh_b: list_head for second mode
973925
*
974-
* LOCKING:
975-
* None.
976-
*
977926
* Compare two modes, given by @lh_a and @lh_b, returning a value indicating
978927
* which is better.
979928
*
@@ -1007,9 +956,6 @@ static int drm_mode_compare(void *priv, struct list_head *lh_a, struct list_head
1007956
* drm_mode_sort - sort mode list
1008957
* @mode_list: list to sort
1009958
*
1010-
* LOCKING:
1011-
* Caller must hold a lock protecting @mode_list.
1012-
*
1013959
* Sort @mode_list by favorability, putting good modes first.
1014960
*/
1015961
void drm_mode_sort(struct list_head *mode_list)
@@ -1022,9 +968,6 @@ EXPORT_SYMBOL(drm_mode_sort);
1022968
* drm_mode_connector_list_update - update the mode list for the connector
1023969
* @connector: the connector to update
1024970
*
1025-
* LOCKING:
1026-
* Caller must hold a lock protecting @mode_list.
1027-
*
1028971
* This moves the modes from the @connector probed_modes list
1029972
* to the actual mode list. It compares the probed mode against the current
1030973
* list and only adds different modes. All modes unverified after this point
@@ -1036,6 +979,8 @@ void drm_mode_connector_list_update(struct drm_connector *connector)
1036979
struct drm_display_mode *pmode, *pt;
1037980
int found_it;
1038981

982+
WARN_ON(!mutex_is_locked(&connector->dev->mode_config.mutex));
983+
1039984
list_for_each_entry_safe(pmode, pt, &connector->probed_modes,
1040985
head) {
1041986
found_it = 0;

0 commit comments

Comments
 (0)