linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: ignore ethtool CamelCase constants
       [not found] <CGME20201022110115eucas1p216072f5c30091771421c8c595242d3b9@eucas1p2.samsung.com>
@ 2020-10-22 11:01 ` Łukasz Stelmach
  2020-10-22 11:57   ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Łukasz Stelmach @ 2020-10-22 11:01 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel
  Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski,
	Łukasz Stelmach

Ignore CamelCase constants describing Ethernet link parameters defined
in include/uapi/linux/ethtool.h.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fab38b493cef..31789c090140 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5295,6 +5295,10 @@ sub process {
 #CamelCase
 			if ($var !~ /^$Constant$/ &&
 			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
+#Ignore constants from include/uapi/linux/ethtool.h
+			    $var !~ /^ETHTOOL_LINK_MODE_[0-9A-Za-z_]+_BIT$/ &&
+			    $var !~ /^ADVERTISED_[0-9A-Za-z_]+$/ &&
+			    $var !~ /^SUPPORTED_[0-9A-Za-z_]+$/ &&
 #Ignore Page<foo> variants
 			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 #Ignore SI style variants like nS, mV and dB
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: ignore ethtool CamelCase constants
  2020-10-22 11:01 ` [PATCH] checkpatch: ignore ethtool CamelCase constants Łukasz Stelmach
@ 2020-10-22 11:57   ` Joe Perches
       [not found]     ` <CGME20201022181506eucas1p22f41b2f48b6ef70e9db8d6cd5fc0b5a1@eucas1p2.samsung.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2020-10-22 11:57 UTC (permalink / raw)
  To: Łukasz Stelmach, Andy Whitcroft, linux-kernel
  Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski

On Thu, 2020-10-22 at 13:01 +0200, Łukasz Stelmach wrote:
> Ignore CamelCase constants describing Ethernet link parameters defined
> in include/uapi/linux/ethtool.h.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5295,6 +5295,10 @@ sub process {
>  #CamelCase
>  			if ($var !~ /^$Constant$/ &&
>  			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
> +#Ignore constants from include/uapi/linux/ethtool.h
> +			    $var !~ /^ETHTOOL_LINK_MODE_[0-9A-Za-z_]+_BIT$/ &&
> +			    $var !~ /^ADVERTISED_[0-9A-Za-z_]+$/ &&
> +			    $var !~ /^SUPPORTED_[0-9A-Za-z_]+$/ &&
>  #Ignore Page<foo> variants
>  			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
>  #Ignore SI style variants like nS, mV and dB

How about changing this to be a bit broader?

$var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/

There are 2 grep searches below:

First is in include/uapi/
Second is just drivers/

Finding the matches in include/uapi shows a
reasonable list, but run against all the .[ch] files
in the kernel shows over 7000 entries.

Maybe that's too large a list.

$ git grep -Poh '#\s*define\s+\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w*' include/uapi
#define DRM_MODE_CONNECTOR_Unknown
#define DRM_MODE_CONNECTOR_Composite
#define DRM_MODE_CONNECTOR_Component
#define DRM_MODE_CONNECTOR_DisplayPort
#define SUPPORTED_Autoneg
#define SUPPORTED_Pause
#define SUPPORTED_Asym_Pause
#define SUPPORTED_Backplane
#define ADVERTISED_Autoneg
#define ADVERTISED_Pause
#define ADVERTISED_Asym_Pause
#define ADVERTISED_Backplane
#define ARPOP_InREQUEST
#define ARPOP_InREPLY
#define K_HEXa
#define K_HEXb
#define K_HEXc
#define K_HEXd
#define K_HEXe
#define K_HEXf
#define MAX_DPs
#define RTMGRP_DECnet_IFADDR
#define RTMGRP_DECnet_ROUTE
#define RTNLGRP_DECnet_IFADDR
#define RTNLGRP_DECnet_ROUTE
#define RTNLGRP_DECnet_RULE
#define UART_RSA_IER_Rx_FIFO_H
#define UART_RSA_IER_Tx_FIFO_H
#define UART_RSA_IER_Tx_FIFO_E
#define UART_RSA_IER_Rx_TOUT
#define UART_RSA_SRR_Tx_FIFO_NEMP
#define UART_RSA_SRR_Tx_FIFO_NHFL
#define UART_RSA_SRR_Tx_FIFO_NFUL
#define UART_RSA_SRR_Rx_FIFO_NEMP
#define UART_RSA_SRR_Rx_FIFO_NHFL
#define UART_RSA_SRR_Rx_FIFO_NFUL
#define UART_RSA_SRR_Rx_TOUT
#define TCPF_CA_Open
#define TCPF_CA_Disorder
#define TCPF_CA_Recovery
#define TCPF_CA_Loss
#define VIRTIO_NET_RSS_HASH_TYPE_IPv4
#define VIRTIO_NET_RSS_HASH_TYPE_TCPv4
#define VIRTIO_NET_RSS_HASH_TYPE_UDPv4
#define VIRTIO_NET_RSS_HASH_TYPE_IPv6
#define VIRTIO_NET_RSS_HASH_TYPE_TCPv6
#define VIRTIO_NET_RSS_HASH_TYPE_UDPv6
#define VIRTIO_NET_HASH_REPORT_IPv4
#define VIRTIO_NET_HASH_REPORT_TCPv4
#define VIRTIO_NET_HASH_REPORT_UDPv4
#define VIRTIO_NET_HASH_REPORT_IPv6
#define VIRTIO_NET_HASH_REPORT_TCPv6
#define VIRTIO_NET_HASH_REPORT_UDPv6
#define VIRTIO_NET_HASH_REPORT_IPv6_EX
#define VIRTIO_NET_HASH_REPORT_TCPv6_EX
#define VIRTIO_NET_HASH_REPORT_UDPv6_EX

But run against drivers it's a huge list.
Maybe too big?
Here are the top used entries.
Take off the awk bits to see the entire list.

It seems about half of all the entries are for autogenerated,
never used names from drivers/gpu and drivers/staging

$ git grep -Poh '\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w+' -- drivers | \
  sort | uniq -c | awk '{if ($1 > 10) { print $0;}}'
     46 ADVERTISED_Asym_Pause
     90 ADVERTISED_Autoneg
     42 ADVERTISED_Pause
     11 AFU_Cntl
     11 AMPDU_Factor
     74 AS_Data
     77 AS_Host
     17 ASIC_Init
     36 ASIC_InternalSS_Info
     11 ATOM_PPLIB_CAC_Leakage_Table
     22 ATOM_PPLIB_Clock_Voltage_Dependency_Table
     11 ATOM_PPLIB_PPM_Table
     11 ATOM_PPLIB_UVD_Clock_Voltage_Limit_Table
     13 ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record
     13 ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table
     11 ATOM_PPLIB_VCE_State_Record
     12 ATOM_PPLIB_VCE_State_Table
     14 ATOM_Tonga_POWERPLAYTABLE
     13 ATOM_Vega10_POWERPLAYTABLE
     11 ATOM_Vega10_Voltage_Lookup_Table
     13 BP_Filter
     16 CCK_Diff
     16 CCK_Table_length
     11 CFGTBL_Trans_io_accel1
    450 CH_Ctrl
     15 CRT_Device
     22 DC_HPDx_INT_ACK
     12 DC_HPDx_INT_CONTROL
     37 DC_HPDx_INT_EN
     33 DC_HPDx_INT_POLARITY
     13 DC_HPDx_RX_INT_ACK
     19 DC_HPDx_RX_INT_EN
     12 DC_HPDx_SENSE
     34 DIG_Dynamic_MIN
     13 DIG_MaxOfMin
     27 DISPCLK_DPPCLK_Support
     13 DMA_Ctl
     34 DM_DigTable
     16 DM_EDCA_Table
     14 DM_FatTable
     57 DM_RxPathSelTable
     12 DM_Type_ByDriver
     22 DRM_MODE_CONNECTOR_Composite
     79 DRM_MODE_CONNECTOR_DisplayPort
     47 DRM_MODE_CONNECTOR_Unknown
     13 DRM_MODE_SUBCONNECTOR_Unknown
     11 DSP_HBridgeControl
     15 DSP_IsaSlaveControl
     14 DVI_Device
     11 EE_ChipSelect
     15 EFUSE_GetEfuseDefinition
     26 ETHTOOL_LINK_MODE_Asym_Pause_BIT
     24 ETHTOOL_LINK_MODE_Autoneg_BIT
     33 ETHTOOL_LINK_MODE_Pause_BIT
     13 F_Port
    137 FPT_BL_Card
     14 HPNA_NoiseFloor
     12 HW_Fsync
     15 IC_Cut
     18 IF_Mode
     14 IGI_Base
     11 IGI_LowerBound
     17 ISPCCDC_COLPTN_Gb_G
     17 ISPCCDC_COLPTN_Gr_Cy
     15 LCD_Device
     11 LIO_Target_ConfigFS
     20 LPS_Leave
     30 LVDS_InfoTable
     12 MDIO_ShiftClk
     11 M_Key
     11 MR_ArPdGet
     21 MR_LdRaidGet
     11 MR_PdDevHandleGet
     11 MR_TargetIdToLdGet
    121 MS_Lib
     21 MS_Status
     34 MT_AGG_ARxCR_LIMIT
    582 MXL_ControlWrite
     12 MXL_Ctrl
    221 MXL_SetGPIO
    333 NI_AI_ConvertClock
     30 NI_AI_ConvertClockTimebase
     17 NI_AI_ExternalMUXClock
     76 NI_AI_PauseTrigger
    377 NI_AI_ReferenceTrigger
    322 NI_AI_SampleClock
     46 NI_AI_SampleClockTimebase
    394 NI_AI_StartTrigger
    415 NI_AnalogComparisonEvent
    117 NI_AO_PauseTrigger
    344 NI_AO_SampleClock
     37 NI_AO_SampleClockTimebase
    326 NI_AO_StartTrigger
    352 NI_ChangeDetectionEvent
     37 NI_CtrA
    239 NI_CtrArmStartTrigger
     49 NI_CtrAux
     35 NI_CtrB
   1041 NI_CtrGate
   1338 NI_CtrInternalOutput
     77 NI_CtrOut
    207 NI_CtrSampleClock
   1101 NI_CtrSource
     78 NI_CtrZ
     15 NI_DI_InputBufferFull
     57 NI_DI_PauseTrigger
     15 NI_DI_ReadyForStartEvent
     15 NI_DI_ReadyForTransferEventBurst
     15 NI_DI_ReadyForTransferEventPipelined
     71 NI_DI_ReferenceTrigger
    249 NI_DI_SampleClock
     69 NI_DI_StartTrigger
     15 NI_DO_DataActiveEvent
     15 NI_DO_OutputBufferFull
     58 NI_DO_PauseTrigger
     15 NI_DO_ReadyForStartEvent
     15 NI_DO_ReadyForTransferEvent
    254 NI_DO_SampleClock
     72 NI_DO_StartTrigger
     17 NI_ExternalStrobe
    284 NI_FrequencyOutput
     56 NI_LogicHigh
    125 NI_LogicLow
     34 NI_MasterTimebase
     18 NI_SCXI_Trig1
     59 NI_WatchdogExpiredEvent
     12 NPHY_RfctrlIntc_override_TRSW
    156 N_Port
     19 NVKM_VMM_PAGE_Sxxx
     14 ODM_CfoTracking
     18 ODM_CmnInfoHook
     12 ODM_CmnInfoInit
     20 ODM_CmnInfoUpdate
     12 ODM_TXPowerTrackingCheck
     24 ODM_Write_DIG
     24 OFDM_Diff
     11 OPA_PortInfo
     12 PCI_Config
     13 PHM_PerformanceLevel
     14 PHM_PerformanceLevelDesignation
     27 PHM_PlatformCaps_AutomaticDCTransition
     11 PHM_PlatformCaps_BACO
     14 PHM_PlatformCaps_ClockStretcher
     17 PHM_PlatformCaps_DBRamping
     11 PHM_PlatformCaps_GCEDC
     49 PHM_PlatformCaps_MicrocodeFanControl
     22 PHM_PlatformCaps_PowerContainment
     11 PHM_PlatformCaps_PSM
     21 PHM_PlatformCaps_RegulatorHot
     19 PHM_PlatformCaps_SclkDeepSleep
     11 PHM_PlatformCaps_SclkThrottleLowNotification
     17 PHM_PlatformCaps_SQRamping
     21 PHM_PlatformCaps_StablePState
     17 PHM_PlatformCaps_TCPRamping
     17 PHM_PlatformCaps_TDRamping
     12 PHM_PlatformCaps_ThermalController
     13 PHM_PlatformCaps_UMDPState
     12 PHM_PlatformCaps_UVDDPM
     11 PHM_PlatformCaps_UVDPowerGating
     11 PHM_PlatformCaps_VCEPowerGating
    104 PHY_GetRateIndexOfTxPowerByRate
     34 PHY_GetTxPowerByRate
     19 PHY_GetTxPowerByRateBase
    108 PHY_QueryBBReg
     17 PHY_QueryRFReg
    295 PHY_SetBBReg
     87 PHY_SetRFReg
     12 PHY_SetTxPowerIndexByRateArray
     18 PHY_SetTxPowerIndexByRateSection
     39 P_Key
     16 P_Kin
     16 P_Kout
     12 POWER_SUPPLY_TECHNOLOGY_NiMH
     18 PP_BusCTL
     14 PP_Clocks
     16 PP_LineCTL
     15 PPM_PkgPwrLimit
     15 PPM_TemperatureLimit
     16 PP_SIslands_CacConfig
     12 PP_SIslands_DPM2Parameters
     14 PP_SIslands_PAPMParameters
     49 PPSMC_Msg
     15 PPSMC_MSG_DisableAllSmuFeatures
     12 PPSMC_MSG_DisableCac
     21 PPSMC_MSG_DisableClockGatingFeature
     12 PPSMC_MSG_DisableULV
     11 PPSMC_MSG_DPM_ForceState
     11 PPSMC_MSG_DramLogSetDramAddrHigh
     11 PPSMC_MSG_DramLogSetDramAddrLow
     11 PPSMC_MSG_DramLogSetDramSize
     15 PPSMC_MSG_EnableAllSmuFeatures
     12 PPSMC_MSG_EnableCac
     21 PPSMC_MSG_EnableClockGatingFeature
     12 PPSMC_MSG_EnableULV
     13 PPSMC_MSG_EnterBaco
     12 PPSMC_MSG_GetDpmFreqByIndex
     16 PPSMC_MSG_GetDriverIfVersion
     11 PPSMC_MSG_GetMaxDpmFreq
     17 PPSMC_MSG_GetSmuVersion
     11 PPSMC_MSG_MCLKDPM_FreezeLevel
     13 PPSMC_MSG_MCLKDPM_SetEnabledMask
     11 PPSMC_MSG_MCLKDPM_UnfreezeLevel
     14 PPSMC_MSG_NoForcedLevel
     13 PPSMC_MSG_NumOfDisplays
     12 PPSMC_MSG_PrepareMp1ForUnload
     13 PPSMC_MSG_SCLKDPM_FreezeLevel
     15 PPSMC_MSG_SCLKDPM_SetEnabledMask
     13 PPSMC_MSG_SCLKDPM_UnfreezeLevel
     29 PPSMC_MSG_SetDriverDramAddrHigh
     29 PPSMC_MSG_SetDriverDramAddrLow
     17 PPSMC_MSG_SetEnabledLevels
     14 PPSMC_MSG_SetForcedLevels
     17 PPSMC_MSG_SetHardMinByFreq
     14 PPSMC_MSG_SetHardMinFclkByFreq
     12 PPSMC_MSG_SetHardMinGfxClk
     11 PPSMC_MSG_SetHardMinSocclkByFreq
     13 PPSMC_MSG_SetMinDeepSleepDcefclk
     11 PPSMC_MSG_SetPptLimit
     13 PPSMC_MSG_SetSclkSoftMax
     13 PPSMC_MSG_SetSclkSoftMin
     21 PPSMC_MSG_SetSoftMaxByFreq
     11 PPSMC_MSG_SetSoftMaxFclkByFreq
     12 PPSMC_MSG_SetSoftMaxGfxClk
     22 PPSMC_MSG_SetSoftMinByFreq
     11 PPSMC_MSG_SetSystemVirtualDramAddrHigh
     11 PPSMC_MSG_SetSystemVirtualDramAddrLow
     12 PPSMC_MSG_SetToolsDramAddrHigh
     12 PPSMC_MSG_SetToolsDramAddrLow
     11 PPSMC_MSG_SetWorkloadMask
     11 PPSMC_MSG_SwitchToMinimumPower
     14 PPSMC_MSG_TestMessage
     23 PPSMC_MSG_TransferTableDram2Smu
     19 PPSMC_MSG_TransferTableSmu2Dram
     13 PPSMC_MSG_UVDDPM_SetEnabledMask
     13 PPSMC_MSG_VCEDPM_SetEnabledMask
     76 PPSMC_Result
     19 PPSMC_Result_Failed
    173 PPSMC_Result_OK
     13 PPSMC_Result_UnknownCmd
     11 PPSMC_StartFanControl
     13 PP_StateClassificationFlag_Boot
     29 PP_TemperatureRange
     34 PXI_Clk10
    123 PXI_Star
     14 QAM_Lock
     18 RES_Tx_P
     18 RF_Path
     20 RF_Type
     12 RGB_Scanlines
     12 RGB_Stride
     21 RSSI_Ave
     56 RSSI_Min
     29 SCC_Info
     11 SCR_RxDecEnable
     23 SD_Status
     12 SENSOR_POxxxx
     20 S_Info
     12 SMC_Evergreen_MCRegisters
     11 SMC_Evergreen_MCRegisterSet
     12 SMC_NIslands_MCRegisterAddress
     16 SMC_NIslands_MCRegisters
     11 SMC_NIslands_MCRegisterSet
     22 SMC_SIslands_MCArbDramTimingRegisterSet
     24 SMC_SIslands_MCRegisters
     14 SMC_SIslands_MCRegisterSet
     24 SMIO_Pattern
     20 SMIO_Table
     11 SMT_Unknown
     16 SMU_ClockStretcherDataTable
     16 SMU_ClockStretcherDataTableEntry
     24 SMU_QuadraticCoeffs
     14 SMU_SclkSetting
     20 SMU_SoftRegisters
     37 SMU_VoltageLevel
     12 SRB_DataOut
     27 SS_Info
     17 S_Status
     27 SUPPORTED_Asym_Pause
    104 SUPPORTED_Autoneg
     33 SUPPORTED_Pause
     12 SW_Fsync
     14 TDC_VDDC_PkgLimit
     28 TDC_VDDC_ThrottleReleaseLimitPerc
     14 TF_Type
     21 TM_Sn_STATUS_OFF
     19 TM_Trigger
     34 TUL_SCmd
     13 TUL_SCnt0
     12 TUL_SConfig
     20 TUL_SCtrl0
     55 TUL_SFifo
     24 TUL_SSignal
     45 TW_Command
     21 TW_Command_Apache_Header
     51 TW_Command_Full
    169 TW_Device_Extension
     22 TW_Event
     18 TW_Ioctl_Buf_Apache
     25 TW_Param
     25 TW_Sector
     18 TW_SG_Entry
     12 TW_SG_Entry_ISO
     23 UV_Scanlines
     19 UV_Stride
     15 UV_UBWC_Plane
     12 VBIOSSMC_Status_BUSY
     26 VB_NoLCD
     17 VM_ContainerConfig
     20 Y_Scanlines
     21 Y_Stride
     15 Y_UBWC_Plane



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: ignore ethtool CamelCase constants
       [not found]     ` <CGME20201022181506eucas1p22f41b2f48b6ef70e9db8d6cd5fc0b5a1@eucas1p2.samsung.com>
@ 2020-10-22 18:14       ` Lukasz Stelmach
  2020-10-22 18:29         ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Stelmach @ 2020-10-22 18:14 UTC (permalink / raw)
  To: Joe Perches
  Cc: Andy Whitcroft, linux-kernel,
	Bartłomiej Żolnierkiewicz, Marek Szyprowski

[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]

It was <2020-10-22 czw 04:57>, when Joe Perches wrote:
> On Thu, 2020-10-22 at 13:01 +0200, Łukasz Stelmach wrote:
>> Ignore CamelCase constants describing Ethernet link parameters defined
>> in include/uapi/linux/ethtool.h.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -5295,6 +5295,10 @@ sub process {
>>  #CamelCase
>>  			if ($var !~ /^$Constant$/ &&
>>  			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
>> +#Ignore constants from include/uapi/linux/ethtool.h
>> +			    $var !~ /^ETHTOOL_LINK_MODE_[0-9A-Za-z_]+_BIT$/ &&
>> +			    $var !~ /^ADVERTISED_[0-9A-Za-z_]+$/ &&
>> +			    $var !~ /^SUPPORTED_[0-9A-Za-z_]+$/ &&
>>  #Ignore Page<foo> variants
>>  			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
>>  #Ignore SI style variants like nS, mV and dB
>
> How about changing this to be a bit broader?
>
> $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/
>
> There are 2 grep searches below:
>
> First is in include/uapi/
> Second is just drivers/
>
> Finding the matches in include/uapi shows a
> reasonable list, but run against all the .[ch] files
> in the kernel shows over 7000 entries.
>
> Maybe that's too large a list.
>
> $ git grep -Poh '#\s*define\s+\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w*' include/uapi
> #define DRM_MODE_CONNECTOR_Unknown

[...]

> #define VIRTIO_NET_HASH_REPORT_UDPv6_EX
>

And we've got enums too.

> But run against drivers it's a huge list.
> Maybe too big?
> Here are the top used entries.
> Take off the awk bits to see the entire list.
>
> It seems about half of all the entries are for autogenerated,
> never used names from drivers/gpu and drivers/staging
>
> $ git grep -Poh '\b(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]\w+' -- drivers | \
>   sort | uniq -c | awk '{if ($1 > 10) { print $0;}}'
>      46 ADVERTISED_Asym_Pause

[...]

>      15 Y_UBWC_Plane

Oh, I had no idea there is so many of them. Your regex loooks
reasonable. However, I am afraid it may allow for some false negatives
(stuff that should be fixed, but won't be reported). I don't know.

-- 
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] checkpatch: ignore ethtool CamelCase constants
  2020-10-22 18:14       ` Lukasz Stelmach
@ 2020-10-22 18:29         ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2020-10-22 18:29 UTC (permalink / raw)
  To: Lukasz Stelmach
  Cc: Andy Whitcroft, linux-kernel,
	Bartłomiej Żolnierkiewicz, Marek Szyprowski

On Thu, 2020-10-22 at 20:14 +0200, Lukasz Stelmach wrote:
> It was <2020-10-22 czw 04:57>, when Joe Perches wrote:
> > On Thu, 2020-10-22 at 13:01 +0200, Łukasz Stelmach wrote:
> > > Ignore CamelCase constants describing Ethernet link parameters defined
> > > in include/uapi/linux/ethtool.h.
> > []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > []
> > > @@ -5295,6 +5295,10 @@ sub process {
> > >  #CamelCase
> > >  			if ($var !~ /^$Constant$/ &&
> > >  			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
> > > +#Ignore constants from include/uapi/linux/ethtool.h
> > > +			    $var !~ /^ETHTOOL_LINK_MODE_[0-9A-Za-z_]+_BIT$/ &&
> > > +			    $var !~ /^ADVERTISED_[0-9A-Za-z_]+$/ &&
> > > +			    $var !~ /^SUPPORTED_[0-9A-Za-z_]+$/ &&
> > >  #Ignore Page<foo> variants
> > >  			    $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
> > >  #Ignore SI style variants like nS, mV and dB
> > 
> > How about changing this to be a bit broader?
> > 
> > $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/
[]
> And we've got enums too.

The regex finds the enums too.
The added 'define' was just to show a simple list.
[]
> Oh, I had no idea there is so many of them. Your regex loooks
> reasonable. However, I am afraid it may allow for some false negatives
> (stuff that should be fixed, but won't be reported). I don't know.

Me neither, but I think it's simpler than the specific
exclusions and I'm generally in favor of simpler.

Most all of the matches it excludes are autogenerated
and would never have been fixed so I think we should
use the regex.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-22 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201022110115eucas1p216072f5c30091771421c8c595242d3b9@eucas1p2.samsung.com>
2020-10-22 11:01 ` [PATCH] checkpatch: ignore ethtool CamelCase constants Łukasz Stelmach
2020-10-22 11:57   ` Joe Perches
     [not found]     ` <CGME20201022181506eucas1p22f41b2f48b6ef70e9db8d6cd5fc0b5a1@eucas1p2.samsung.com>
2020-10-22 18:14       ` Lukasz Stelmach
2020-10-22 18:29         ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).