@@ -159,7 +159,7 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev,
159159 return sysfs_emit (buf , "%llu\n" , cnt );
160160}
161161
162- static DEVICE_ATTR (pcie_replay_count , S_IRUGO ,
162+ static DEVICE_ATTR (pcie_replay_count , 0444 ,
163163 amdgpu_device_get_pcie_replay_count , NULL) ;
164164
165165static void amdgpu_device_get_pcie_info (struct amdgpu_device * adev );
@@ -183,7 +183,7 @@ static ssize_t amdgpu_device_get_product_name(struct device *dev,
183183 return sysfs_emit (buf , "%s\n" , adev -> product_name );
184184}
185185
186- static DEVICE_ATTR (product_name , S_IRUGO ,
186+ static DEVICE_ATTR (product_name , 0444 ,
187187 amdgpu_device_get_product_name , NULL) ;
188188
189189/**
@@ -205,7 +205,7 @@ static ssize_t amdgpu_device_get_product_number(struct device *dev,
205205 return sysfs_emit (buf , "%s\n" , adev -> product_number );
206206}
207207
208- static DEVICE_ATTR (product_number , S_IRUGO ,
208+ static DEVICE_ATTR (product_number , 0444 ,
209209 amdgpu_device_get_product_number , NULL) ;
210210
211211/**
@@ -227,7 +227,7 @@ static ssize_t amdgpu_device_get_serial_number(struct device *dev,
227227 return sysfs_emit (buf , "%s\n" , adev -> serial );
228228}
229229
230- static DEVICE_ATTR (serial_number , S_IRUGO ,
230+ static DEVICE_ATTR (serial_number , 0444 ,
231231 amdgpu_device_get_serial_number , NULL) ;
232232
233233/**
@@ -481,8 +481,7 @@ uint32_t amdgpu_device_rreg(struct amdgpu_device *adev,
481481/*
482482 * MMIO register read with bytes helper functions
483483 * @offset:bytes offset from MMIO start
484- *
485- */
484+ */
486485
487486/**
488487 * amdgpu_mm_rreg8 - read a memory mapped IO register
@@ -506,8 +505,8 @@ uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset)
506505 * MMIO register write with bytes helper functions
507506 * @offset:bytes offset from MMIO start
508507 * @value: the value want to be written to the register
509- *
510- */
508+ */
509+
511510/**
512511 * amdgpu_mm_wreg8 - read a memory mapped IO register
513512 *
@@ -991,7 +990,7 @@ static void amdgpu_device_mem_scratch_fini(struct amdgpu_device *adev)
991990 * @registers: pointer to the register array
992991 * @array_size: size of the register array
993992 *
994- * Programs an array or registers with and and or masks.
993+ * Programs an array or registers with and or masks.
995994 * This is a helper for setting golden registers.
996995 */
997996void amdgpu_device_program_register_sequence (struct amdgpu_device * adev ,
@@ -1157,7 +1156,7 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
11571156 int rbar_size = pci_rebar_bytes_to_size (adev -> gmc .real_vram_size );
11581157 struct pci_bus * root ;
11591158 struct resource * res ;
1160- unsigned i ;
1159+ unsigned int i ;
11611160 u16 cmd ;
11621161 int r ;
11631162
@@ -1226,9 +1225,8 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
12261225
12271226static bool amdgpu_device_read_bios (struct amdgpu_device * adev )
12281227{
1229- if (hweight32 (adev -> aid_mask ) && (adev -> flags & AMD_IS_APU )) {
1228+ if (hweight32 (adev -> aid_mask ) && (adev -> flags & AMD_IS_APU ))
12301229 return false;
1231- }
12321230
12331231 return true;
12341232}
@@ -1264,6 +1262,7 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev)
12641262 if (adev -> asic_type == CHIP_FIJI ) {
12651263 int err ;
12661264 uint32_t fw_ver ;
1265+
12671266 err = request_firmware (& adev -> pm .fw , "amdgpu/fiji_smc.bin" , adev -> dev );
12681267 /* force vPost if error occured */
12691268 if (err )
@@ -1366,6 +1365,7 @@ static unsigned int amdgpu_device_vga_set_decode(struct pci_dev *pdev,
13661365 bool state )
13671366{
13681367 struct amdgpu_device * adev = drm_to_adev (pci_get_drvdata (pdev ));
1368+
13691369 amdgpu_asic_set_vga_state (adev , state );
13701370 if (state )
13711371 return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
@@ -1388,7 +1388,8 @@ static void amdgpu_device_check_block_size(struct amdgpu_device *adev)
13881388{
13891389 /* defines number of bits in page table versus page directory,
13901390 * a page is 4KB so we have 12 bits offset, minimum 9 bits in the
1391- * page table and the remaining bits are in the page directory */
1391+ * page table and the remaining bits are in the page directory
1392+ */
13921393 if (amdgpu_vm_block_size == -1 )
13931394 return ;
13941395
@@ -1620,7 +1621,7 @@ static bool amdgpu_switcheroo_can_switch(struct pci_dev *pdev)
16201621{
16211622 struct drm_device * dev = pci_get_drvdata (pdev );
16221623
1623- /*
1624+ /*
16241625 * FIXME: open_count is protected by drm_global_mutex but that would lead to
16251626 * locking inversion with the driver load path. And the access here is
16261627 * completely racy anyway. So don't bother with locking for now.
@@ -3265,7 +3266,7 @@ static int amdgpu_device_ip_resume_phase2(struct amdgpu_device *adev)
32653266 *
32663267 * Main resume function for hardware IPs. The hardware IPs
32673268 * are split into two resume functions because they are
3268- * are also used in in recovering from a GPU reset and some additional
3269+ * also used in recovering from a GPU reset and some additional
32693270 * steps need to be take between them. In this case (S3/S4) they are
32703271 * run sequentially.
32713272 * Returns 0 on success, negative error code on failure.
@@ -3367,8 +3368,7 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type)
33673368#else
33683369 default :
33693370 if (amdgpu_dc > 0 )
3370- DRM_INFO_ONCE ("Display Core has been requested via kernel parameter "
3371- "but isn't supported by ASIC, ignoring\n" );
3371+ DRM_INFO_ONCE ("Display Core has been requested via kernel parameter but isn't supported by ASIC, ignoring\n" );
33723372 return false;
33733373#endif
33743374 }
@@ -3616,7 +3616,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
36163616 pdev -> subsystem_vendor , pdev -> subsystem_device , pdev -> revision );
36173617
36183618 /* mutex initialization are all done here so we
3619- * can recall function without having locking issues */
3619+ * can recall function without having locking issues
3620+ */
36203621 mutex_init (& adev -> firmware .mutex );
36213622 mutex_init (& adev -> pm .mutex );
36223623 mutex_init (& adev -> gfx .gpu_clock_mutex );
@@ -3693,11 +3694,11 @@ int amdgpu_device_init(struct amdgpu_device *adev,
36933694 atomic_set (& adev -> pm .pwr_state [i ], POWER_STATE_UNKNOWN );
36943695
36953696 adev -> rmmio = ioremap (adev -> rmmio_base , adev -> rmmio_size );
3696- if (adev -> rmmio == NULL ) {
3697+ if (! adev -> rmmio )
36973698 return - ENOMEM ;
3698- }
3699+
36993700 DRM_INFO ("register mmio base: 0x%08X\n" , (uint32_t )adev -> rmmio_base );
3700- DRM_INFO ("register mmio size: %u\n" , (unsigned )adev -> rmmio_size );
3701+ DRM_INFO ("register mmio size: %u\n" , (unsigned int )adev -> rmmio_size );
37013702
37023703 /*
37033704 * Reset domain needs to be present early, before XGMI hive discovered
@@ -3951,7 +3952,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,
39513952
39523953 /* if we have > 1 VGA cards, then disable the amdgpu VGA resources */
39533954 /* this will fail for cards that aren't VGA class devices, just
3954- * ignore it */
3955+ * ignore it
3956+ */
39553957 if ((adev -> pdev -> class >> 8 ) == PCI_CLASS_DISPLAY_VGA )
39563958 vga_client_register (adev -> pdev , amdgpu_device_vga_set_decode );
39573959
@@ -4034,7 +4036,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
40344036
40354037 /* make sure IB test finished before entering exclusive mode
40364038 * to avoid preemption on IB test
4037- * * /
4039+ */
40384040 if (amdgpu_sriov_vf (adev )) {
40394041 amdgpu_virt_request_full_gpu (adev , false);
40404042 amdgpu_virt_fini_data_exchange (adev );
@@ -4771,8 +4773,9 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
47714773 if (!ring || !ring -> sched .thread )
47724774 continue ;
47734775
4774- /*clear job fence from fence drv to avoid force_completion
4775- *leave NULL and vm flush fence in fence drv */
4776+ /* Clear job fence from fence drv to avoid force_completion
4777+ * leave NULL and vm flush fence in fence drv
4778+ */
47764779 amdgpu_fence_driver_clear_job_fences (ring );
47774780
47784781 /* after all hw jobs are reset, hw fence is meaningless, so force_completion */
@@ -4786,7 +4789,7 @@ int amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
47864789
47874790 r = amdgpu_reset_prepare_hwcontext (adev , reset_context );
47884791 /* If reset handler not implemented, continue; otherwise return */
4789- if (r == - ENOSYS )
4792+ if (r == - EOPNOTSUPP )
47904793 r = 0 ;
47914794 else
47924795 return r ;
@@ -4904,7 +4907,7 @@ int amdgpu_do_asic_reset(struct list_head *device_list_handle,
49044907 reset_context -> reset_device_list = device_list_handle ;
49054908 r = amdgpu_reset_perform_reset (tmp_adev , reset_context );
49064909 /* If reset handler not implemented, continue; otherwise return */
4907- if (r == - ENOSYS )
4910+ if (r == - EOPNOTSUPP )
49084911 r = 0 ;
49094912 else
49104913 return r ;
@@ -5393,9 +5396,8 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
53935396 if (adev -> enable_mes && adev -> ip_versions [GC_HWIP ][0 ] != IP_VERSION (11 , 0 , 3 ))
53945397 amdgpu_mes_self_test (tmp_adev );
53955398
5396- if (!drm_drv_uses_atomic_modeset (adev_to_drm (tmp_adev )) && !job_signaled ) {
5399+ if (!drm_drv_uses_atomic_modeset (adev_to_drm (tmp_adev )) && !job_signaled )
53975400 drm_helper_resume_force_mode (adev_to_drm (tmp_adev ));
5398- }
53995401
54005402 if (tmp_adev -> asic_reset_res )
54015403 r = tmp_adev -> asic_reset_res ;
0 commit comments