[PATCH] gpu: drm: nouveau: nvif: device: Remove unused function

2015-01-13 Thread Rickard Strandqvist
2015-01-12 0:13 GMT+01:00 Ben Skeggs :
> On Sun, Jan 11, 2015 at 11:53 PM, Rickard Strandqvist
>  wrote:
>
> Hey Rickard,
>
>> Remove the function nvif_device_new() that is not used anywhere.
> It's used, just not by the kernel.  All the code under core/ and nvif/
> is also built into a userspace library (not in the kernel tree,
> obviously) and used by tools / testing apps.
>
> I'll pick up the rest of your nouveau patches though, aside from the
> one Samuel is taking care of.
>
> Thanks,
> Ben.
>
>>
>> This was partially found by using a static code analysis program called 
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist > spectrumdigital.se>
>> ---
>>  drivers/gpu/drm/nouveau/nvif/device.c |   18 --
>>  drivers/gpu/drm/nouveau/nvif/device.h |2 --
>>  2 files changed, 20 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvif/device.c 
>> b/drivers/gpu/drm/nouveau/nvif/device.c
>> index f477579..8522aa9 100644
>> --- a/drivers/gpu/drm/nouveau/nvif/device.c
>> +++ b/drivers/gpu/drm/nouveau/nvif/device.c
>> @@ -53,24 +53,6 @@ nvif_device_del(struct nvif_device *device)
>> kfree(device);
>>  }
>>
>> -int
>> -nvif_device_new(struct nvif_object *parent, u32 handle, u32 oclass,
>> -   void *data, u32 size, struct nvif_device **pdevice)
>> -{
>> -   struct nvif_device *device = kzalloc(sizeof(*device), GFP_KERNEL);
>> -   if (device) {
>> -   int ret = nvif_device_init(parent, nvif_device_del, handle,
>> -  oclass, data, size, device);
>> -   if (ret) {
>> -   kfree(device);
>> -   device = NULL;
>> -   }
>> -   *pdevice = device;
>> -   return ret;
>> -   }
>> -   return -ENOMEM;
>> -}
>> -
>>  void
>>  nvif_device_ref(struct nvif_device *device, struct nvif_device **pdevice)
>>  {
>> diff --git a/drivers/gpu/drm/nouveau/nvif/device.h 
>> b/drivers/gpu/drm/nouveau/nvif/device.h
>> index 43180f9..8440848 100644
>> --- a/drivers/gpu/drm/nouveau/nvif/device.h
>> +++ b/drivers/gpu/drm/nouveau/nvif/device.h
>> @@ -22,8 +22,6 @@ int  nvif_device_init(struct nvif_object *, void 
>> (*dtor)(struct nvif_device *),
>>   u32 handle, u32 oclass, void *, u32,
>>   struct nvif_device *);
>>  void nvif_device_fini(struct nvif_device *);
>> -int  nvif_device_new(struct nvif_object *, u32 handle, u32 oclass,
>> -        void *, u32, struct nvif_device **);
>>  void nvif_device_ref(struct nvif_device *, struct nvif_device **);
>>
>>  /*XXX*/
>> --
>> 1.7.10.4
>>
>> ___
>> dri-devel mailing list
>> dri-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel


Hi Ben

Okay, thanks good to know.


Kind regards
Rickard Strandqvist


[PATCH] drm/radeon/radeon_i2c: Remove unused function

2015-01-13 Thread Rickard Strandqvist
Remove the function radeon_best_encoder() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon_i2c.c  |5 -
 drivers/gpu/drm/radeon/radeon_mode.h |2 --
 2 files changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index add6220..9590bcd 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -1048,11 +1048,6 @@ struct radeon_i2c_chan *radeon_i2c_lookup(struct 
radeon_device *rdev,
return NULL;
 }

-struct drm_encoder *radeon_best_encoder(struct drm_connector *connector)
-{
-   return NULL;
-}
-
 void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus,
 u8 slave_addr,
 u8 addr,
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h 
b/drivers/gpu/drm/radeon/radeon_mode.h
index 04db2fd..66c17e3 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -740,8 +740,6 @@ extern void radeon_router_select_ddc_port(struct 
radeon_connector *radeon_connec
 extern void radeon_router_select_cd_port(struct radeon_connector 
*radeon_connector);
 extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool 
use_aux);

-extern struct drm_encoder *radeon_best_encoder(struct drm_connector 
*connector);
-
 extern bool radeon_atombios_get_ppll_ss_info(struct radeon_device *rdev,
 struct radeon_atom_ss *ss,
 int id);
-- 
1.7.10.4



[PATCH] drm/radeon/radeon_fb: Remove unused function

2015-01-13 Thread Rickard Strandqvist
Remove the function radeon_fbdev_total_size() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon_fb.c   |   10 --
 drivers/gpu/drm/radeon/radeon_mode.h |1 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_fb.c 
b/drivers/gpu/drm/radeon/radeon_fb.c
index 0ea1db8..76adbdb 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -389,16 +389,6 @@ void radeon_fbdev_set_suspend(struct radeon_device *rdev, 
int state)
fb_set_suspend(rdev->mode_info.rfbdev->helper.fbdev, state);
 }

-int radeon_fbdev_total_size(struct radeon_device *rdev)
-{
-   struct radeon_bo *robj;
-   int size = 0;
-
-   robj = gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj);
-   size += radeon_bo_size(robj);
-   return size;
-}
-
 bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo 
*robj)
 {
if (robj == gem_to_radeon_bo(rdev->mode_info.rfbdev->rfb.obj))
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h 
b/drivers/gpu/drm/radeon/radeon_mode.h
index 04db2fd..ec2014a 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -915,7 +915,6 @@ void dce8_program_fmt(struct drm_encoder *encoder);
 int radeon_fbdev_init(struct radeon_device *rdev);
 void radeon_fbdev_fini(struct radeon_device *rdev);
 void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);
-int radeon_fbdev_total_size(struct radeon_device *rdev);
 bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo 
*robj);

 void radeon_fb_output_poll_changed(struct radeon_device *rdev);
-- 
1.7.10.4



[PATCH] drm/radeon/rv515: Remove unused function

2015-01-13 Thread Rickard Strandqvist
Remove the function rv515_ring_start() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon_asic.h |1 -
 drivers/gpu/drm/radeon/rv515.c   |   68 --
 2 files changed, 69 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_asic.h 
b/drivers/gpu/drm/radeon/radeon_asic.h
index d8ace5b..52667b3 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -280,7 +280,6 @@ int rv515_init(struct radeon_device *rdev);
 void rv515_fini(struct radeon_device *rdev);
 uint32_t rv515_mc_rreg(struct radeon_device *rdev, uint32_t reg);
 void rv515_mc_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
-void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring);
 void rv515_bandwidth_update(struct radeon_device *rdev);
 int rv515_resume(struct radeon_device *rdev);
 int rv515_suspend(struct radeon_device *rdev);
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 8a477bf..cb966e6 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -59,74 +59,6 @@ void rv515_debugfs(struct radeon_device *rdev)
}
 }

-void rv515_ring_start(struct radeon_device *rdev, struct radeon_ring *ring)
-{
-   int r;
-
-   r = radeon_ring_lock(rdev, ring, 64);
-   if (r) {
-   return;
-   }
-   radeon_ring_write(ring, PACKET0(ISYNC_CNTL, 0));
-   radeon_ring_write(ring,
- ISYNC_ANY2D_IDLE3D |
- ISYNC_ANY3D_IDLE2D |
- ISYNC_WAIT_IDLEGUI |
- ISYNC_CPSCRATCH_IDLEGUI);
-   radeon_ring_write(ring, PACKET0(WAIT_UNTIL, 0));
-   radeon_ring_write(ring, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN);
-   radeon_ring_write(ring, PACKET0(R300_DST_PIPE_CONFIG, 0));
-   radeon_ring_write(ring, R300_PIPE_AUTO_CONFIG);
-   radeon_ring_write(ring, PACKET0(GB_SELECT, 0));
-   radeon_ring_write(ring, 0);
-   radeon_ring_write(ring, PACKET0(GB_ENABLE, 0));
-   radeon_ring_write(ring, 0);
-   radeon_ring_write(ring, PACKET0(R500_SU_REG_DEST, 0));
-   radeon_ring_write(ring, (1 << rdev->num_gb_pipes) - 1);
-   radeon_ring_write(ring, PACKET0(VAP_INDEX_OFFSET, 0));
-   radeon_ring_write(ring, 0);
-   radeon_ring_write(ring, PACKET0(RB3D_DSTCACHE_CTLSTAT, 0));
-   radeon_ring_write(ring, RB3D_DC_FLUSH | RB3D_DC_FREE);
-   radeon_ring_write(ring, PACKET0(ZB_ZCACHE_CTLSTAT, 0));
-   radeon_ring_write(ring, ZC_FLUSH | ZC_FREE);
-   radeon_ring_write(ring, PACKET0(WAIT_UNTIL, 0));
-   radeon_ring_write(ring, WAIT_2D_IDLECLEAN | WAIT_3D_IDLECLEAN);
-   radeon_ring_write(ring, PACKET0(GB_AA_CONFIG, 0));
-   radeon_ring_write(ring, 0);
-   radeon_ring_write(ring, PACKET0(RB3D_DSTCACHE_CTLSTAT, 0));
-   radeon_ring_write(ring, RB3D_DC_FLUSH | RB3D_DC_FREE);
-   radeon_ring_write(ring, PACKET0(ZB_ZCACHE_CTLSTAT, 0));
-   radeon_ring_write(ring, ZC_FLUSH | ZC_FREE);
-   radeon_ring_write(ring, PACKET0(GB_MSPOS0, 0));
-   radeon_ring_write(ring,
- ((6 << MS_X0_SHIFT) |
-  (6 << MS_Y0_SHIFT) |
-  (6 << MS_X1_SHIFT) |
-  (6 << MS_Y1_SHIFT) |
-  (6 << MS_X2_SHIFT) |
-  (6 << MS_Y2_SHIFT) |
-  (6 << MSBD0_Y_SHIFT) |
-  (6 << MSBD0_X_SHIFT)));
-   radeon_ring_write(ring, PACKET0(GB_MSPOS1, 0));
-   radeon_ring_write(ring,
- ((6 << MS_X3_SHIFT) |
-  (6 << MS_Y3_SHIFT) |
-  (6 << MS_X4_SHIFT) |
-  (6 << MS_Y4_SHIFT) |
-  (6 << MS_X5_SHIFT) |
-  (6 << MS_Y5_SHIFT) |
-  (6 << MSBD1_SHIFT)));
-   radeon_ring_write(ring, PACKET0(GA_ENHANCE, 0));
-   radeon_ring_write(ring, GA_DEADLOCK_CNTL | GA_FASTSYNC_CNTL);
-   radeon_ring_write(ring, PACKET0(GA_POLY_MODE, 0));
-   radeon_ring_write(ring, FRONT_PTYPE_TRIANGE | BACK_PTYPE_TRIANGE);
-   radeon_ring_write(ring, PACKET0(GA_ROUND_MODE, 0));
-   radeon_ring_write(ring, GEOMETRY_ROUND_NEAREST | COLOR_ROUND_NEAREST);
-   radeon_ring_write(ring, PACKET0(0x20C8, 0));
-   radeon_ring_write(ring, 0);
-   radeon_ring_unlock_commit(rdev, ring, false);
-}
-
 int rv515_mc_wait_for_idle(struct radeon_device *rdev)
 {
unsigned i;
-- 
1.7.10.4



[PATCH] drm/radeon/sumo_dpm: Remove some unused functions

2015-01-13 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
sumo_convert_vid7_to_vid2() sumo_dpm_reset_asic()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/sumo_dpm.c |   26 --
 drivers/gpu/drm/radeon/sumo_dpm.h |3 ---
 2 files changed, 29 deletions(-)

diff --git a/drivers/gpu/drm/radeon/sumo_dpm.c 
b/drivers/gpu/drm/radeon/sumo_dpm.c
index 1f8a883..e5d66a2 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.c
+++ b/drivers/gpu/drm/radeon/sumo_dpm.c
@@ -1338,18 +1338,6 @@ void sumo_dpm_post_set_power_state(struct radeon_device 
*rdev)
sumo_update_current_ps(rdev, new_ps);
 }

-void sumo_dpm_reset_asic(struct radeon_device *rdev)
-{
-   sumo_program_bootup_state(rdev);
-   sumo_enable_power_level_0(rdev);
-   sumo_set_forced_level_0(rdev);
-   sumo_set_forced_mode_enabled(rdev);
-   sumo_wait_for_level_0(rdev);
-   sumo_set_forced_mode_disabled(rdev);
-   sumo_set_forced_mode_enabled(rdev);
-   sumo_set_forced_mode_disabled(rdev);
-}
-
 void sumo_dpm_setup_asic(struct radeon_device *rdev)
 {
struct sumo_power_info *pi = sumo_get_pi(rdev);
@@ -1537,20 +1525,6 @@ u32 sumo_convert_vid2_to_vid7(struct radeon_device *rdev,
return vid_mapping_table->entries[vid_mapping_table->num_entries - 
1].vid_7bit;
 }

-u32 sumo_convert_vid7_to_vid2(struct radeon_device *rdev,
- struct sumo_vid_mapping_table *vid_mapping_table,
- u32 vid_7bit)
-{
-   u32 i;
-
-   for (i = 0; i < vid_mapping_table->num_entries; i++) {
-   if (vid_mapping_table->entries[i].vid_7bit == vid_7bit)
-   return vid_mapping_table->entries[i].vid_2bit;
-   }
-
-   return vid_mapping_table->entries[vid_mapping_table->num_entries - 
1].vid_2bit;
-}
-
 static u16 sumo_convert_voltage_index_to_value(struct radeon_device *rdev,
   u32 vid_2bit)
 {
diff --git a/drivers/gpu/drm/radeon/sumo_dpm.h 
b/drivers/gpu/drm/radeon/sumo_dpm.h
index db1ea32..07dda29 100644
--- a/drivers/gpu/drm/radeon/sumo_dpm.h
+++ b/drivers/gpu/drm/radeon/sumo_dpm.h
@@ -202,9 +202,6 @@ void sumo_construct_vid_mapping_table(struct radeon_device 
*rdev,
 u32 sumo_convert_vid2_to_vid7(struct radeon_device *rdev,
  struct sumo_vid_mapping_table *vid_mapping_table,
  u32 vid_2bit);
-u32 sumo_convert_vid7_to_vid2(struct radeon_device *rdev,
- struct sumo_vid_mapping_table *vid_mapping_table,
- u32 vid_7bit);
 u32 sumo_get_sleep_divider_from_id(u32 id);
 u32 sumo_get_sleep_divider_id_from_clock(struct radeon_device *rdev,
 u32 sclk,
-- 
1.7.10.4



[PATCH] drm/radeon/rv770_dpm: Remove some unused functions

2015-01-13 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
rv770_read_smc_soft_register() rv770_dpm_reset_asic()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/rv770_dpm.c |   23 ---
 drivers/gpu/drm/radeon/rv770_dpm.h |2 --
 2 files changed, 25 deletions(-)

diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c 
b/drivers/gpu/drm/radeon/rv770_dpm.c
index 755a8f9..a5b537a 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.c
+++ b/drivers/gpu/drm/radeon/rv770_dpm.c
@@ -231,16 +231,6 @@ u8 rv770_get_seq_value(struct radeon_device *rdev,
MC_CG_SEQ_DRAMCONF_S0 : MC_CG_SEQ_DRAMCONF_S1;
 }

-int rv770_read_smc_soft_register(struct radeon_device *rdev,
-u16 reg_offset, u32 *value)
-{
-   struct rv7xx_power_info *pi = rv770_get_pi(rdev);
-
-   return rv770_read_smc_sram_dword(rdev,
-pi->soft_regs_start + reg_offset,
-value, pi->sram_end);
-}
-
 int rv770_write_smc_soft_register(struct radeon_device *rdev,
  u16 reg_offset, u32 value)
 {
@@ -2075,19 +2065,6 @@ int rv770_dpm_set_power_state(struct radeon_device *rdev)
return 0;
 }

-void rv770_dpm_reset_asic(struct radeon_device *rdev)
-{
-   struct rv7xx_power_info *pi = rv770_get_pi(rdev);
-   struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps;
-
-   rv770_restrict_performance_levels_before_switch(rdev);
-   if (pi->dcodt)
-   rv770_program_dcodt_before_state_switch(rdev, boot_ps, boot_ps);
-   rv770_set_boot_state(rdev);
-   if (pi->dcodt)
-   rv770_program_dcodt_after_state_switch(rdev, boot_ps, boot_ps);
-}
-
 void rv770_dpm_setup_asic(struct radeon_device *rdev)
 {
struct rv7xx_power_info *pi = rv770_get_pi(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h 
b/drivers/gpu/drm/radeon/rv770_dpm.h
index f776634..d12beab 100644
--- a/drivers/gpu/drm/radeon/rv770_dpm.h
+++ b/drivers/gpu/drm/radeon/rv770_dpm.h
@@ -278,8 +278,6 @@ void rv770_set_uvd_clock_after_set_eng_clock(struct 
radeon_device *rdev,
 void rv770_get_engine_memory_ss(struct radeon_device *rdev);

 /* smc */
-int rv770_read_smc_soft_register(struct radeon_device *rdev,
-u16 reg_offset, u32 *value);
 int rv770_write_smc_soft_register(struct radeon_device *rdev,
  u16 reg_offset, u32 value);

-- 
1.7.10.4



[PATCH] drm/nouveau/nvif/notify: Remove unused function

2015-01-13 Thread Rickard Strandqvist
Remove the function nvif_notify_ref() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/nvif/notify.c |9 -
 drivers/gpu/drm/nouveau/nvif/notify.h |1 -
 2 files changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvif/notify.c 
b/drivers/gpu/drm/nouveau/nvif/notify.c
index 0898c31..d1c26db 100644
--- a/drivers/gpu/drm/nouveau/nvif/notify.c
+++ b/drivers/gpu/drm/nouveau/nvif/notify.c
@@ -219,15 +219,6 @@ nvif_notify_del(struct nvif_notify *notify)
kfree(notify);
 }

-void
-nvif_notify_ref(struct nvif_notify *notify, struct nvif_notify **pnotify)
-{
-   BUG_ON(notify != NULL);
-   if (*pnotify)
-   (*pnotify)->dtor(*pnotify);
-   *pnotify = notify;
-}
-
 int
 nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *),
bool work, u8 type, void *data, u32 size, u32 reply,
diff --git a/drivers/gpu/drm/nouveau/nvif/notify.h 
b/drivers/gpu/drm/nouveau/nvif/notify.h
index 9ebfa3b..ea8593e 100644
--- a/drivers/gpu/drm/nouveau/nvif/notify.h
+++ b/drivers/gpu/drm/nouveau/nvif/notify.h
@@ -34,6 +34,5 @@ int  nvif_notify(const void *, u32, const void *, u32);
 int  nvif_notify_new(struct nvif_object *, int (*func)(struct nvif_notify *),
 bool work, u8 type, void *data, u32 size, u32 reply,
 struct nvif_notify **);
-void nvif_notify_ref(struct nvif_notify *, struct nvif_notify **);

 #endif
-- 
1.7.10.4



[PATCH] drm/nouveau/dispnv04/disp: Remove some unused functions

2015-01-11 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
nv04_display_late_takedown() nv04_display_early_init()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/dispnv04/disp.c |   18 --
 drivers/gpu/drm/nouveau/dispnv04/disp.h |2 --
 2 files changed, 20 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c 
b/drivers/gpu/drm/nouveau/dispnv04/disp.c
index 3d0afa1..bdf7cf4 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c
@@ -32,24 +32,6 @@
 #include "nouveau_connector.h"

 int
-nv04_display_early_init(struct drm_device *dev)
-{
-   /* ensure vblank interrupts are off, they can't be enabled until
-* drm_vblank has been initialised
-*/
-   NVWriteCRTC(dev, 0, NV_PCRTC_INTR_EN_0, 0);
-   if (nv_two_heads(dev))
-   NVWriteCRTC(dev, 1, NV_PCRTC_INTR_EN_0, 0);
-
-   return 0;
-}
-
-void
-nv04_display_late_takedown(struct drm_device *dev)
-{
-}
-
-int
 nv04_display_create(struct drm_device *dev)
 {
struct nouveau_drm *drm = nouveau_drm(dev);
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.h 
b/drivers/gpu/drm/nouveau/dispnv04/disp.h
index 17b899d..3ad3ee8 100644
--- a/drivers/gpu/drm/nouveau/dispnv04/disp.h
+++ b/drivers/gpu/drm/nouveau/dispnv04/disp.h
@@ -90,8 +90,6 @@ nv04_display(struct drm_device *dev)
 }

 /* nv04_display.c */
-int nv04_display_early_init(struct drm_device *);
-void nv04_display_late_takedown(struct drm_device *);
 int nv04_display_create(struct drm_device *);
 void nv04_display_destroy(struct drm_device *);
 int nv04_display_init(struct drm_device *);
-- 
1.7.10.4



[PATCH] drm/nouveau/nouveau_bo: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function nouveau_bo_rd16() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/nouveau_bo.c |   12 
 drivers/gpu/drm/nouveau/nouveau_bo.h |1 -
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c 
b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 3d474ac..7cde2e0 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -418,18 +418,6 @@ nouveau_bo_validate(struct nouveau_bo *nvbo, bool 
interruptible,
return 0;
 }

-u16
-nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index)
-{
-   bool is_iomem;
-   u16 *mem = ttm_kmap_obj_virtual(&nvbo->kmap, &is_iomem);
-   mem = &mem[index];
-   if (is_iomem)
-   return ioread16_native((void __force __iomem *)mem);
-   else
-   return *mem;
-}
-
 void
 nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val)
 {
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h 
b/drivers/gpu/drm/nouveau/nouveau_bo.h
index 22d2c76..82aaebd 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.h
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.h
@@ -77,7 +77,6 @@ int  nouveau_bo_unpin(struct nouveau_bo *);
 int  nouveau_bo_map(struct nouveau_bo *);
 void nouveau_bo_unmap(struct nouveau_bo *);
 void nouveau_bo_placement_set(struct nouveau_bo *, u32 type, u32 busy);
-u16  nouveau_bo_rd16(struct nouveau_bo *, unsigned index);
 void nouveau_bo_wr16(struct nouveau_bo *, unsigned index, u16 val);
 u32  nouveau_bo_rd32(struct nouveau_bo *, unsigned index);
 void nouveau_bo_wr32(struct nouveau_bo *, unsigned index, u32 val);
-- 
1.7.10.4



[PATCH] drm/radeon/kv_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function kv_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/kv_dpm.c |   21 -
 1 file changed, 21 deletions(-)

diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 9b42001..61a9b14 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -1925,27 +1925,6 @@ void kv_dpm_setup_asic(struct radeon_device *rdev)
kv_init_sclk_t(rdev);
 }

-void kv_dpm_reset_asic(struct radeon_device *rdev)
-{
-   struct kv_power_info *pi = kv_get_pi(rdev);
-
-   if (rdev->family == CHIP_KABINI || rdev->family == CHIP_MULLINS) {
-   kv_force_lowest_valid(rdev);
-   kv_init_graphics_levels(rdev);
-   kv_program_bootup_state(rdev);
-   kv_upload_dpm_settings(rdev);
-   kv_force_lowest_valid(rdev);
-   kv_unforce_levels(rdev);
-   } else {
-   kv_init_graphics_levels(rdev);
-   kv_program_bootup_state(rdev);
-   kv_freeze_sclk_dpm(rdev, true);
-   kv_upload_dpm_settings(rdev);
-   kv_freeze_sclk_dpm(rdev, false);
-   kv_set_enabled_level(rdev, pi->graphics_boot_level);
-   }
-}
-
 //XXX use sumo_dpm_display_configuration_changed

 static void kv_construct_max_power_limits_table(struct radeon_device *rdev,
-- 
1.7.10.4



[PATCH] drm: nouveau: core: engine: perfmon: base: Remove unused function

2015-01-11 Thread Rickard Strandqvist
2015-01-11 22:00 GMT+01:00 Samuel Pitoiset :
> Hi Rickard,
>
> Thanks for submitting this patch, but I already submitted the same a few
> weeks ago. :-)
>
> This function will be removed when I will submit my work on this area.
>
> Greetings,
> Samuel Pitoiset.
>
>
> On 01/11/2015 07:12 PM, Rickard Strandqvist wrote:
>>
>> Remove the function nouveau_perfsig_wrap() that is not used anywhere.
>>
>> This was partially found by using a static code analysis program called
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist
>> 
>> ---
>>   drivers/gpu/drm/nouveau/core/engine/perfmon/base.c |   20
>> 
>>   drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h |5 -
>>   2 files changed, 25 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
>> b/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
>> index 6301381..d0c5255 100644
>> --- a/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
>> +++ b/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
>> @@ -80,26 +80,6 @@ nouveau_perfsig_find(struct nouveau_perfmon *ppm, const
>> char *name, u32 size,
>> return nouveau_perfsig_find_(dom, name, size);
>>   }
>>   -struct nouveau_perfctr *
>> -nouveau_perfsig_wrap(struct nouveau_perfmon *ppm, const char *name,
>> -struct nouveau_perfdom **pdom)
>> -{
>> -   struct nouveau_perfsig *sig;
>> -   struct nouveau_perfctr *ctr;
>> -
>> -   sig = nouveau_perfsig_find(ppm, name, strlen(name), pdom);
>> -   if (!sig)
>> -   return NULL;
>> -
>> -   ctr = kzalloc(sizeof(*ctr), GFP_KERNEL);
>> -   if (ctr) {
>> -   ctr->signal[0] = sig;
>> -   ctr->logic_op = 0x;
>> -   }
>> -
>> -   return ctr;
>> -}
>> -
>>
>> /***
>>* Perfmon object classes
>>
>> **/
>> diff --git a/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
>> b/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
>> index 0ac8714..1a0989e 100644
>> --- a/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
>> +++ b/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
>> @@ -30,11 +30,6 @@ struct nouveau_perfsig {
>> const char *name;
>>   };
>>   -struct nouveau_perfdom;
>> -struct nouveau_perfctr *
>> -nouveau_perfsig_wrap(struct nouveau_perfmon *, const char *,
>> -struct nouveau_perfdom **);
>> -
>>   struct nouveau_specdom {
>> u16 signal_nr;
>> const struct nouveau_specsig *signal;
>
>


Hi Samuel

Thanks, another of the drawbacks that I start this off too long ago :(


Kind regards
Rickard Strandqvist


[PATCH] drm: nouveau: core: engine: perfmon: base: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function nouveau_perfsig_wrap() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/core/engine/perfmon/base.c |   20 
 drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h |5 -
 2 files changed, 25 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c 
b/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
index 6301381..d0c5255 100644
--- a/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
+++ b/drivers/gpu/drm/nouveau/core/engine/perfmon/base.c
@@ -80,26 +80,6 @@ nouveau_perfsig_find(struct nouveau_perfmon *ppm, const char 
*name, u32 size,
return nouveau_perfsig_find_(dom, name, size);
 }

-struct nouveau_perfctr *
-nouveau_perfsig_wrap(struct nouveau_perfmon *ppm, const char *name,
-struct nouveau_perfdom **pdom)
-{
-   struct nouveau_perfsig *sig;
-   struct nouveau_perfctr *ctr;
-
-   sig = nouveau_perfsig_find(ppm, name, strlen(name), pdom);
-   if (!sig)
-   return NULL;
-
-   ctr = kzalloc(sizeof(*ctr), GFP_KERNEL);
-   if (ctr) {
-   ctr->signal[0] = sig;
-   ctr->logic_op = 0x;
-   }
-
-   return ctr;
-}
-
 
/***
  * Perfmon object classes
  
**/
diff --git a/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h 
b/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
index 0ac8714..1a0989e 100644
--- a/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
+++ b/drivers/gpu/drm/nouveau/core/engine/perfmon/priv.h
@@ -30,11 +30,6 @@ struct nouveau_perfsig {
const char *name;
 };

-struct nouveau_perfdom;
-struct nouveau_perfctr *
-nouveau_perfsig_wrap(struct nouveau_perfmon *, const char *,
-struct nouveau_perfdom **);
-
 struct nouveau_specdom {
u16 signal_nr;
const struct nouveau_specsig *signal;
-- 
1.7.10.4



[PATCH] drm: gma500: psb_irq: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function mid_pipe_vsync() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/gma500/psb_irq.c |   12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/gma500/psb_irq.c b/drivers/gpu/drm/gma500/psb_irq.c
index 624eb36..dcfd0a7 100644
--- a/drivers/gpu/drm/gma500/psb_irq.c
+++ b/drivers/gpu/drm/gma500/psb_irq.c
@@ -59,18 +59,6 @@ mid_pipe_event(int pipe)
 }

 static inline u32
-mid_pipe_vsync(int pipe)
-{
-   if (pipe == 0)
-   return _PSB_VSYNC_PIPEA_FLAG;
-   if (pipe == 1)
-   return _PSB_VSYNC_PIPEB_FLAG;
-   if (pipe == 2)
-   return _MDFLD_PIPEC_VBLANK_FLAG;
-   BUG();
-}
-
-static inline u32
 mid_pipeconf(int pipe)
 {
if (pipe == 0)
-- 
1.7.10.4



[PATCH] drm: radeon: si_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function si_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/si_dpm.c |7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 676e6c2..5e2fb9a 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -6154,13 +6154,6 @@ void si_dpm_post_set_power_state(struct radeon_device 
*rdev)
 }


-void si_dpm_reset_asic(struct radeon_device *rdev)
-{
-   si_restrict_performance_levels_before_switch(rdev);
-   si_disable_ulv(rdev);
-   si_set_boot_state(rdev);
-}
-
 void si_dpm_display_configuration_changed(struct radeon_device *rdev)
 {
si_program_display_gap(rdev);
-- 
1.7.10.4



[PATCH] drm: radeon: cypress_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function cypress_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/cypress_dpm.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c 
b/drivers/gpu/drm/radeon/cypress_dpm.c
index 9aad032..d3f8208 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -2005,12 +2005,6 @@ int cypress_dpm_set_power_state(struct radeon_device 
*rdev)
return 0;
 }

-void cypress_dpm_reset_asic(struct radeon_device *rdev)
-{
-   rv770_restrict_performance_levels_before_switch(rdev);
-   rv770_set_boot_state(rdev);
-}
-
 void cypress_dpm_display_configuration_changed(struct radeon_device *rdev)
 {
cypress_program_display_gap(rdev);
-- 
1.7.10.4



[PATCH] drm: radeon: trinity_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function trinity_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/trinity_dpm.c |   16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/gpu/drm/radeon/trinity_dpm.c 
b/drivers/gpu/drm/radeon/trinity_dpm.c
index b4ec5c4..7428da0 100644
--- a/drivers/gpu/drm/radeon/trinity_dpm.c
+++ b/drivers/gpu/drm/radeon/trinity_dpm.c
@@ -1269,22 +1269,6 @@ void trinity_dpm_setup_asic(struct radeon_device *rdev)
trinity_release_mutex(rdev);
 }

-void trinity_dpm_reset_asic(struct radeon_device *rdev)
-{
-   struct trinity_power_info *pi = trinity_get_pi(rdev);
-
-   trinity_acquire_mutex(rdev);
-   if (pi->enable_dpm) {
-   trinity_enable_power_level_0(rdev);
-   trinity_force_level_0(rdev);
-   trinity_wait_for_level_0(rdev);
-   trinity_program_bootup_state(rdev);
-   trinity_force_level_0(rdev);
-   trinity_unforce_levels(rdev);
-   }
-   trinity_release_mutex(rdev);
-}
-
 static u16 trinity_convert_voltage_index_to_value(struct radeon_device *rdev,
  u32 vid_2bit)
 {
-- 
1.7.10.4



[PATCH] drm: radeon: ni_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function ni_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/ni_dpm.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 6d2f16c..dcd5568 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -3862,12 +3862,6 @@ void ni_dpm_post_set_power_state(struct radeon_device 
*rdev)
ni_update_current_ps(rdev, new_ps);
 }

-void ni_dpm_reset_asic(struct radeon_device *rdev)
-{
-   ni_restrict_performance_levels_before_switch(rdev);
-   rv770_set_boot_state(rdev);
-}
-
 union power_info {
struct _ATOM_POWERPLAY_INFO info;
struct _ATOM_POWERPLAY_INFO_V2 info_2;
-- 
1.7.10.4



[PATCH] drm: radeon: ci_dpm: Remove some unused functions

2015-01-11 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
ci_dpm_reset_asic() ci_dpm_power_control_set_level()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/ci_dpm.c |   10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c
index 11a55e9..06060a5 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.c
+++ b/drivers/gpu/drm/radeon/ci_dpm.c
@@ -4804,16 +4804,6 @@ int ci_dpm_set_power_state(struct radeon_device *rdev)
return 0;
 }

-int ci_dpm_power_control_set_level(struct radeon_device *rdev)
-{
-   return ci_power_control_set_level(rdev);
-}
-
-void ci_dpm_reset_asic(struct radeon_device *rdev)
-{
-   ci_set_boot_state(rdev);
-}
-
 void ci_dpm_display_configuration_changed(struct radeon_device *rdev)
 {
ci_program_display_gap(rdev);
-- 
1.7.10.4



[PATCH] drm: nouveau: nouveau_gem: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function domain_to_ttm() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/nouveau_gem.c |   13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c 
b/drivers/gpu/drm/nouveau/nouveau_gem.c
index 36951ee..f208d3a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
@@ -825,19 +825,6 @@ out_next:
return nouveau_abi16_put(abi16, ret);
 }

-static inline uint32_t
-domain_to_ttm(struct nouveau_bo *nvbo, uint32_t domain)
-{
-   uint32_t flags = 0;
-
-   if (domain & NOUVEAU_GEM_DOMAIN_VRAM)
-   flags |= TTM_PL_FLAG_VRAM;
-   if (domain & NOUVEAU_GEM_DOMAIN_GART)
-   flags |= TTM_PL_FLAG_TT;
-
-   return flags;
-}
-
 int
 nouveau_gem_ioctl_cpu_prep(struct drm_device *dev, void *data,
   struct drm_file *file_priv)
-- 
1.7.10.4



[PATCH] drm: radeon: btc_dpm: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function btc_dpm_reset_asic() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/btc_dpm.c |8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c
index 0b2929d..fea7130 100644
--- a/drivers/gpu/drm/radeon/btc_dpm.c
+++ b/drivers/gpu/drm/radeon/btc_dpm.c
@@ -2277,14 +2277,6 @@ static void btc_update_requested_ps(struct radeon_device 
*rdev,
eg_pi->requested_rps.ps_priv = &eg_pi->requested_ps;
 }

-void btc_dpm_reset_asic(struct radeon_device *rdev)
-{
-   rv770_restrict_performance_levels_before_switch(rdev);
-   btc_disable_ulv(rdev);
-   btc_set_boot_state_timing(rdev);
-   rv770_set_boot_state(rdev);
-}
-
 int btc_dpm_pre_set_power_state(struct radeon_device *rdev)
 {
struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
-- 
1.7.10.4



[PATCH] gpu: drm: nouveau: nvif: device: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function nvif_device_new() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/nvif/device.c |   18 --
 drivers/gpu/drm/nouveau/nvif/device.h |2 --
 2 files changed, 20 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvif/device.c 
b/drivers/gpu/drm/nouveau/nvif/device.c
index f477579..8522aa9 100644
--- a/drivers/gpu/drm/nouveau/nvif/device.c
+++ b/drivers/gpu/drm/nouveau/nvif/device.c
@@ -53,24 +53,6 @@ nvif_device_del(struct nvif_device *device)
kfree(device);
 }

-int
-nvif_device_new(struct nvif_object *parent, u32 handle, u32 oclass,
-   void *data, u32 size, struct nvif_device **pdevice)
-{
-   struct nvif_device *device = kzalloc(sizeof(*device), GFP_KERNEL);
-   if (device) {
-   int ret = nvif_device_init(parent, nvif_device_del, handle,
-  oclass, data, size, device);
-   if (ret) {
-   kfree(device);
-   device = NULL;
-   }
-   *pdevice = device;
-   return ret;
-   }
-   return -ENOMEM;
-}
-
 void
 nvif_device_ref(struct nvif_device *device, struct nvif_device **pdevice)
 {
diff --git a/drivers/gpu/drm/nouveau/nvif/device.h 
b/drivers/gpu/drm/nouveau/nvif/device.h
index 43180f9..8440848 100644
--- a/drivers/gpu/drm/nouveau/nvif/device.h
+++ b/drivers/gpu/drm/nouveau/nvif/device.h
@@ -22,8 +22,6 @@ int  nvif_device_init(struct nvif_object *, void 
(*dtor)(struct nvif_device *),
  u32 handle, u32 oclass, void *, u32,
  struct nvif_device *);
 void nvif_device_fini(struct nvif_device *);
-int  nvif_device_new(struct nvif_object *, u32 handle, u32 oclass,
-void *, u32, struct nvif_device **);
 void nvif_device_ref(struct nvif_device *, struct nvif_device **);

 /*XXX*/
-- 
1.7.10.4



[PATCH] gpu: drm: radeon: radeon_object: Remove unused function

2015-01-11 Thread Rickard Strandqvist
Remove the function radeon_bo_fbdev_mmap() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon_object.c |6 --
 drivers/gpu/drm/radeon/radeon_object.h |2 --
 2 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c 
b/drivers/gpu/drm/radeon/radeon_object.c
index 99a960a..4f2515f 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -542,12 +542,6 @@ int radeon_bo_list_validate(struct radeon_device *rdev,
return 0;
 }

-int radeon_bo_fbdev_mmap(struct radeon_bo *bo,
-struct vm_area_struct *vma)
-{
-   return ttm_fbdev_mmap(vma, &bo->tbo);
-}
-
 int radeon_bo_get_surface_reg(struct radeon_bo *bo)
 {
struct radeon_device *rdev = bo->rdev;
diff --git a/drivers/gpu/drm/radeon/radeon_object.h 
b/drivers/gpu/drm/radeon/radeon_object.h
index 1b8ec79..1cf3cd9 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -143,8 +143,6 @@ extern void radeon_bo_fini(struct radeon_device *rdev);
 extern int radeon_bo_list_validate(struct radeon_device *rdev,
   struct ww_acquire_ctx *ticket,
   struct list_head *head, int ring);
-extern int radeon_bo_fbdev_mmap(struct radeon_bo *bo,
-   struct vm_area_struct *vma);
 extern int radeon_bo_set_tiling_flags(struct radeon_bo *bo,
u32 tiling_flags, u32 pitch);
 extern void radeon_bo_get_tiling_flags(struct radeon_bo *bo,
-- 
1.7.10.4



[PATCH] gpu: drm: radeon: ci_smc: Remove unused function

2015-01-04 Thread Rickard Strandqvist
Remove the function ci_wait_for_smc_inactive() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/ci_dpm.h |1 -
 drivers/gpu/drm/radeon/ci_smc.c |   18 --
 2 files changed, 19 deletions(-)

diff --git a/drivers/gpu/drm/radeon/ci_dpm.h b/drivers/gpu/drm/radeon/ci_dpm.h
index 93bbed9..596d17e 100644
--- a/drivers/gpu/drm/radeon/ci_dpm.h
+++ b/drivers/gpu/drm/radeon/ci_dpm.h
@@ -322,7 +322,6 @@ void ci_stop_smc_clock(struct radeon_device *rdev);
 void ci_start_smc_clock(struct radeon_device *rdev);
 bool ci_is_smc_running(struct radeon_device *rdev);
 PPSMC_Result ci_send_msg_to_smc(struct radeon_device *rdev, PPSMC_Msg msg);
-PPSMC_Result ci_wait_for_smc_inactive(struct radeon_device *rdev);
 int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit);
 int ci_read_smc_sram_dword(struct radeon_device *rdev,
   u32 smc_address, u32 *value, u32 limit);
diff --git a/drivers/gpu/drm/radeon/ci_smc.c b/drivers/gpu/drm/radeon/ci_smc.c
index b630edc..4f78b8c 100644
--- a/drivers/gpu/drm/radeon/ci_smc.c
+++ b/drivers/gpu/drm/radeon/ci_smc.c
@@ -184,24 +184,6 @@ PPSMC_Result ci_send_msg_to_smc(struct radeon_device 
*rdev, PPSMC_Msg msg)
return (PPSMC_Result)tmp;
 }

-PPSMC_Result ci_wait_for_smc_inactive(struct radeon_device *rdev)
-{
-   u32 tmp;
-   int i;
-
-   if (!ci_is_smc_running(rdev))
-   return PPSMC_Result_OK;
-
-   for (i = 0; i < rdev->usec_timeout; i++) {
-tmp = RREG32_SMC(SMC_SYSCON_CLOCK_CNTL_0);
-if ((tmp & CKEN) == 0)
-   break;
-udelay(1);
-}
-
-   return PPSMC_Result_OK;
-}
-
 int ci_load_smc_ucode(struct radeon_device *rdev, u32 limit)
 {
unsigned long flags;
-- 
1.7.10.4



[PATCH] gpu: drm: armada: armada_drv: Remove unused function

2015-01-02 Thread Rickard Strandqvist
Remove the function armada_drm_vbl_event_remove_unlocked() that is not used 
anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/armada/armada_drm.h |2 --
 drivers/gpu/drm/armada/armada_drv.c |   10 --
 2 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_drm.h 
b/drivers/gpu/drm/armada/armada_drm.h
index ea63c6c..5f6aef0 100644
--- a/drivers/gpu/drm/armada/armada_drm.h
+++ b/drivers/gpu/drm/armada/armada_drm.h
@@ -46,8 +46,6 @@ void armada_drm_vbl_event_add(struct armada_crtc *,
struct armada_vbl_event *);
 void armada_drm_vbl_event_remove(struct armada_crtc *,
struct armada_vbl_event *);
-void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *,
-   struct armada_vbl_event *);
 #define armada_drm_vbl_event_init(_e, _f, _d) do { \
struct armada_vbl_event *__e = _e;  \
INIT_LIST_HEAD(&__e->node); \
diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 908e531..f862bae 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -253,16 +253,6 @@ void armada_drm_vbl_event_remove(struct armada_crtc *dcrtc,
}
 }

-void armada_drm_vbl_event_remove_unlocked(struct armada_crtc *dcrtc,
-   struct armada_vbl_event *evt)
-{
-   unsigned long flags;
-
-   spin_lock_irqsave(&dcrtc->irq_lock, flags);
-   armada_drm_vbl_event_remove(dcrtc, evt);
-   spin_unlock_irqrestore(&dcrtc->irq_lock, flags);
-}
-
 /* These are called under the vbl_lock. */
 static int armada_drm_enable_vblank(struct drm_device *dev, int crtc)
 {
-- 
1.7.10.4



[PATCH] gpu: drm: armada: armada_output: Remove some unused functions

2015-01-02 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
armada_drm_encoder_mode_fixup() armada_drm_encoder_commit() 
armada_drm_encoder_prepare()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/armada/armada_output.c |   16 
 drivers/gpu/drm/armada/armada_output.h |6 --
 2 files changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/armada/armada_output.c 
b/drivers/gpu/drm/armada/armada_output.c
index abbc309..5a98231 100644
--- a/drivers/gpu/drm/armada/armada_output.c
+++ b/drivers/gpu/drm/armada/armada_output.c
@@ -72,22 +72,6 @@ static const struct drm_connector_funcs 
armada_drm_conn_funcs = {
.set_property   = armada_drm_connector_set_property,
 };

-void armada_drm_encoder_prepare(struct drm_encoder *encoder)
-{
-   encoder_helper_funcs(encoder)->dpms(encoder, DRM_MODE_DPMS_OFF);
-}
-
-void armada_drm_encoder_commit(struct drm_encoder *encoder)
-{
-   encoder_helper_funcs(encoder)->dpms(encoder, DRM_MODE_DPMS_ON);
-}
-
-bool armada_drm_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode, struct drm_display_mode *adjusted)
-{
-   return true;
-}
-
 /* Shouldn't this be a generic helper function? */
 int armada_drm_slave_encoder_mode_valid(struct drm_connector *conn,
struct drm_display_mode *mode)
diff --git a/drivers/gpu/drm/armada/armada_output.h 
b/drivers/gpu/drm/armada/armada_output.h
index 4126d43..d3a6ce7 100644
--- a/drivers/gpu/drm/armada/armada_output.h
+++ b/drivers/gpu/drm/armada/armada_output.h
@@ -21,12 +21,6 @@ struct armada_output_type {

 struct drm_encoder *armada_drm_connector_encoder(struct drm_connector *conn);

-void armada_drm_encoder_prepare(struct drm_encoder *encoder);
-void armada_drm_encoder_commit(struct drm_encoder *encoder);
-
-bool armada_drm_encoder_mode_fixup(struct drm_encoder *encoder,
-   const struct drm_display_mode *mode, struct drm_display_mode *adj);
-
 int armada_drm_slave_encoder_mode_valid(struct drm_connector *conn,
struct drm_display_mode *mode);

-- 
1.7.10.4



[PATCH] gpu: drm: qxl: qxl_fb: Remove some unused functions

2015-01-01 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
qxl_fbdev_qobj_is_fb() qxl_get_handle_for_primary_fb()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/qxl/qxl_drv.h |4 
 drivers/gpu/drm/qxl/qxl_fb.c  |   22 --
 2 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 7c6cafe..090b9e0 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -379,9 +379,6 @@ qxl_bo_physical_address(struct qxl_device *qdev, struct 
qxl_bo *bo,

 int qxl_fbdev_init(struct qxl_device *qdev);
 void qxl_fbdev_fini(struct qxl_device *qdev);
-int qxl_get_handle_for_primary_fb(struct qxl_device *qdev,
- struct drm_file *file_priv,
- uint32_t *handle);
 void qxl_fbdev_set_suspend(struct qxl_device *qdev, int state);

 /* qxl_display.c */
@@ -550,7 +547,6 @@ irqreturn_t qxl_irq_handler(int irq, void *arg);

 /* qxl_fb.c */
 int qxl_fb_init(struct qxl_device *qdev);
-bool qxl_fbdev_qobj_is_fb(struct qxl_device *qdev, struct qxl_bo *qobj);

 int qxl_debugfs_add_files(struct qxl_device *qdev,
  struct drm_info_list *files,
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 3d7c1d0..4242577 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -426,21 +426,6 @@ static void qxlfb_destroy_pinned_object(struct 
drm_gem_object *gobj)
drm_gem_object_unreference_unlocked(gobj);
 }

-int qxl_get_handle_for_primary_fb(struct qxl_device *qdev,
- struct drm_file *file_priv,
- uint32_t *handle)
-{
-   int r;
-   struct drm_gem_object *gobj = qdev->fbdev_qfb->obj;
-
-   BUG_ON(!gobj);
-   /* drm_get_handle_create adds a reference - good */
-   r = drm_gem_handle_create(file_priv, gobj, handle);
-   if (r)
-   return r;
-   return 0;
-}
-
 static int qxlfb_create_pinned_object(struct qxl_fbdev *qfbdev,
  struct drm_mode_fb_cmd2 *mode_cmd,
  struct drm_gem_object **gobj_p)
@@ -710,10 +695,3 @@ void qxl_fbdev_set_suspend(struct qxl_device *qdev, int 
state)
 {
fb_set_suspend(qdev->mode_info.qfbdev->helper.fbdev, state);
 }
-
-bool qxl_fbdev_qobj_is_fb(struct qxl_device *qdev, struct qxl_bo *qobj)
-{
-   if (qobj == gem_to_qxl_bo(qdev->mode_info.qfbdev->qfb.obj))
-   return true;
-   return false;
-}
-- 
1.7.10.4



[PATCH] gpu: drm: qxl: qxl_cmd.c: Remove some unused functions

2015-01-01 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
qxl_io_flush_surfaces() qxl_io_flush_release()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/qxl/qxl_cmd.c |   10 --
 drivers/gpu/drm/qxl/qxl_drv.h |2 --
 2 files changed, 12 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
index 9782364..f62d857 100644
--- a/drivers/gpu/drm/qxl/qxl_cmd.c
+++ b/drivers/gpu/drm/qxl/qxl_cmd.c
@@ -360,16 +360,6 @@ void qxl_io_notify_oom(struct qxl_device *qdev)
outb(0, qdev->io_base + QXL_IO_NOTIFY_OOM);
 }

-void qxl_io_flush_release(struct qxl_device *qdev)
-{
-   outb(0, qdev->io_base + QXL_IO_FLUSH_RELEASE);
-}
-
-void qxl_io_flush_surfaces(struct qxl_device *qdev)
-{
-   wait_for_io_cmd(qdev, 0, QXL_IO_FLUSH_SURFACES_ASYNC);
-}
-

 void qxl_io_destroy_primary(struct qxl_device *qdev)
 {
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 7c6cafe..c84cd95 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -467,8 +467,6 @@ int qxl_io_update_area(struct qxl_device *qdev, struct 
qxl_bo *surf,
 void qxl_io_reset(struct qxl_device *qdev);
 void qxl_io_monitors_config(struct qxl_device *qdev);
 int qxl_ring_push(struct qxl_ring *ring, const void *new_elt, bool 
interruptible);
-void qxl_io_flush_release(struct qxl_device *qdev);
-void qxl_io_flush_surfaces(struct qxl_device *qdev);

 union qxl_release_info *qxl_release_map(struct qxl_device *qdev,
struct qxl_release *release);
-- 
1.7.10.4



[PATCH] gpu: drm: gma500: mmu.c: Remove unused function

2015-01-01 Thread Rickard Strandqvist
Remove the function psb_get_default_pd_addr() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/gma500/mmu.c |9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
index 0eaf11c..557cae7 100644
--- a/drivers/gpu/drm/gma500/mmu.c
+++ b/drivers/gpu/drm/gma500/mmu.c
@@ -426,15 +426,6 @@ struct psb_mmu_pd *psb_mmu_get_default_pd(struct 
psb_mmu_driver *driver)
return pd;
 }

-/* Returns the physical address of the PD shared by sgx/msvdx */
-uint32_t psb_get_default_pd_addr(struct psb_mmu_driver *driver)
-{
-   struct psb_mmu_pd *pd;
-
-   pd = psb_mmu_get_default_pd(driver);
-   return page_to_pfn(pd->p) << PAGE_SHIFT;
-}
-
 void psb_mmu_driver_takedown(struct psb_mmu_driver *driver)
 {
struct drm_device *dev = driver->dev;
-- 
1.7.10.4



[PATCH] gpu: drm: qxl: qxl_gem.c: Remove some unused functions

2015-01-01 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
qxl_gem_fini() qxl_gem_init()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/qxl/qxl_drv.h |2 --
 drivers/gpu/drm/qxl/qxl_gem.c |   11 ---
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index 7c6cafe..32b7743 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -400,8 +400,6 @@ void qxl_crtc_set_from_monitors_config(struct qxl_device 
*qdev);
 void qxl_alloc_client_monitors_config(struct qxl_device *qdev, unsigned count);

 /* qxl_gem.c */
-int qxl_gem_init(struct qxl_device *qdev);
-void qxl_gem_fini(struct qxl_device *qdev);
 int qxl_gem_object_create(struct qxl_device *qdev, int size,
  int alignment, int initial_domain,
  bool discardable, bool kernel,
diff --git a/drivers/gpu/drm/qxl/qxl_gem.c b/drivers/gpu/drm/qxl/qxl_gem.c
index b96f0c9..fd6ef25 100644
--- a/drivers/gpu/drm/qxl/qxl_gem.c
+++ b/drivers/gpu/drm/qxl/qxl_gem.c
@@ -104,14 +104,3 @@ void qxl_gem_object_close(struct drm_gem_object *obj,
  struct drm_file *file_priv)
 {
 }
-
-int qxl_gem_init(struct qxl_device *qdev)
-{
-   INIT_LIST_HEAD(&qdev->gem.objects);
-   return 0;
-}
-
-void qxl_gem_fini(struct qxl_device *qdev)
-{
-   qxl_bo_force_delete(qdev);
-}
-- 
1.7.10.4



[PATCH] gpu: drm: radeon: radeon_device.c: Remove unused function

2014-12-21 Thread Rickard Strandqvist
Remove the function radeon_doorbell_free() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon.h|1 -
 drivers/gpu/drm/radeon/radeon_device.c |   14 --
 2 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a9717b3..93e7cfc 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -700,7 +700,6 @@ struct radeon_doorbell {
 };

 int radeon_doorbell_get(struct radeon_device *rdev, u32 *page);
-void radeon_doorbell_free(struct radeon_device *rdev, u32 doorbell);

 /*
  * IRQS.
diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index ea26769..16a 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -363,20 +363,6 @@ int radeon_doorbell_get(struct radeon_device *rdev, u32 
*doorbell)
}
 }

-/**
- * radeon_doorbell_free - Free a doorbell entry
- *
- * @rdev: radeon_device pointer
- * @doorbell: doorbell index
- *
- * Free a doorbell allocated for use by the driver (all asics)
- */
-void radeon_doorbell_free(struct radeon_device *rdev, u32 doorbell)
-{
-   if (doorbell < rdev->doorbell.num_doorbells)
-   __clear_bit(doorbell, rdev->doorbell.used);
-}
-
 /*
  * radeon_wb_*()
  * Writeback is the the method by which the the GPU updates special pages
-- 
1.7.10.4



[PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function

2014-12-21 Thread Rickard Strandqvist
2014-12-21 3:46 GMT+01:00 Ben Skeggs :
> - Original Message -
>> From: "Rickard Strandqvist" 
>> To: "David Airlie" , "Ben Skeggs" > redhat.com>
>> Cc: "Rickard Strandqvist" , 
>> "Alexandre Courbot" , "Ilia
>> Mirkin" , dri-devel at lists.freedesktop.org, 
>> linux-kernel at vger.kernel.org
>> Sent: Sunday, 21 December, 2014 2:54:16 AM
>> Subject: [PATCH] gpu: drm: nouveau: core: subdev: clock: base.c:  Remove 
>> unused function
>>
>> Remove the function nouveau_clock_astate() that is not used anywhere.
> No, don't remove this.  It's only not used because noone got around to 
> finishing load-based reclocking yet.
>
> NVIDIA has an implementation for the GK20A in the works that uses it.
>
> Ben.
>
>>
>> This was partially found by using a static code analysis program called
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist > spectrumdigital.se>
>> ---
>>  drivers/gpu/drm/nouveau/core/include/subdev/clock.h |1 -
>>  drivers/gpu/drm/nouveau/core/subdev/clock/base.c|   10 --
>>  2 files changed, 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> index 36ed035..8577945 100644
>> --- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> +++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
>> @@ -159,7 +159,6 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct
>> nvbios_pll *,
>>   int clk, struct nouveau_pll_vals *);
>>
>>  int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
>> -int nouveau_clock_astate(struct nouveau_clock *, int req, int rel);
>>  int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
>>  int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);
>>
>> diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> index e51b72d..b2c852a 100644
>> --- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> +++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
>> @@ -430,16 +430,6 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req,
>> int pwr)
>>  }
>>
>>  int
>> -nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel)
>> -{
>> - if (!rel) clk->astate  = req;
>> - if ( rel) clk->astate += rel;
>> - clk->astate = min(clk->astate, clk->state_nr - 1);
>> - clk->astate = max(clk->astate, 0);
>> - return nouveau_pstate_calc(clk, true);
>> -}
>> -
>> -int
>>  nouveau_clock_tstate(struct nouveau_clock *clk, int req, int rel)
>>  {
>>   if (!rel) clk->tstate  = req;
>> --
>> 1.7.10.4
>>


Hi

Ok, sorry.
But maybe there should be a comment on the function.

Kind regards
Rickard Strandqvist


[PATCH] gpu: drm: ast: ast_dp501.c: Remove unused function

2014-12-20 Thread Rickard Strandqvist
Remove the function ast_load_dp501_microcode() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/ast/ast_dp501.c |   12 
 drivers/gpu/drm/ast/ast_drv.h   |1 -
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_dp501.c b/drivers/gpu/drm/ast/ast_dp501.c
index 76f07f3..28c977c 100644
--- a/drivers/gpu/drm/ast/ast_dp501.c
+++ b/drivers/gpu/drm/ast/ast_dp501.c
@@ -4,18 +4,6 @@
 #include "ast_drv.h"
 MODULE_FIRMWARE("ast_dp501_fw.bin");

-int ast_load_dp501_microcode(struct drm_device *dev)
-{
-   struct ast_private *ast = dev->dev_private;
-   static char *fw_name = "ast_dp501_fw.bin";
-   int err;
-   err = request_firmware(&ast->dp501_fw, fw_name, dev->dev);
-   if (err)
-   return err;
-
-   return 0;
-}
-
 static void send_ack(struct ast_private *ast)
 {
u8 sendack;
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 86205a2..67a872d 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -393,7 +393,6 @@ void ast_post_gpu(struct drm_device *dev);
 u32 ast_mindwm(struct ast_private *ast, u32 r);
 void ast_moutdwm(struct ast_private *ast, u32 r, u32 v);
 /* ast dp501 */
-int ast_load_dp501_microcode(struct drm_device *dev);
 void ast_set_dp501_video_output(struct drm_device *dev, u8 mode);
 bool ast_launch_m68k(struct drm_device *dev);
 bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
-- 
1.7.10.4



[PATCH] gpu: drm: sti: sti_drm_crtc.c: Remove unused function

2014-12-20 Thread Rickard Strandqvist
Remove the function sti_drm_crtc_is_main() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/sti/sti_drm_crtc.c |   10 --
 drivers/gpu/drm/sti/sti_drm_crtc.h |1 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.c 
b/drivers/gpu/drm/sti/sti_drm_crtc.c
index d2ae0c0..be53e35 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.c
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.c
@@ -389,16 +389,6 @@ static struct drm_crtc_funcs sti_crtc_funcs = {
.set_property = sti_drm_crtc_set_property,
 };

-bool sti_drm_crtc_is_main(struct drm_crtc *crtc)
-{
-   struct sti_mixer *mixer = to_sti_mixer(crtc);
-
-   if (mixer->id == STI_MIXER_MAIN)
-   return true;
-
-   return false;
-}
-
 int sti_drm_crtc_init(struct drm_device *drm_dev, struct sti_mixer *mixer,
struct drm_plane *primary, struct drm_plane *cursor)
 {
diff --git a/drivers/gpu/drm/sti/sti_drm_crtc.h 
b/drivers/gpu/drm/sti/sti_drm_crtc.h
index caca8b1..ddae8fe 100644
--- a/drivers/gpu/drm/sti/sti_drm_crtc.h
+++ b/drivers/gpu/drm/sti/sti_drm_crtc.h
@@ -17,6 +17,5 @@ int sti_drm_crtc_enable_vblank(struct drm_device *dev, int 
crtc);
 void sti_drm_crtc_disable_vblank(struct drm_device *dev, int crtc);
 int sti_drm_crtc_vblank_cb(struct notifier_block *nb,
unsigned long event, void *data);
-bool sti_drm_crtc_is_main(struct drm_crtc *drm_crtc);

 #endif
-- 
1.7.10.4



[PATCH] gpu: drm: nouveau: core: subdev: clock: base.c: Remove unused function

2014-12-20 Thread Rickard Strandqvist
Remove the function nouveau_clock_astate() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/nouveau/core/include/subdev/clock.h |1 -
 drivers/gpu/drm/nouveau/core/subdev/clock/base.c|   10 --
 2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h 
b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
index 36ed035..8577945 100644
--- a/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
+++ b/drivers/gpu/drm/nouveau/core/include/subdev/clock.h
@@ -159,7 +159,6 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct 
nvbios_pll *,
int clk, struct nouveau_pll_vals *);

 int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
-int nouveau_clock_astate(struct nouveau_clock *, int req, int rel);
 int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
 int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);

diff --git a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c 
b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
index e51b72d..b2c852a 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/clock/base.c
@@ -430,16 +430,6 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req, 
int pwr)
 }

 int
-nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel)
-{
-   if (!rel) clk->astate  = req;
-   if ( rel) clk->astate += rel;
-   clk->astate = min(clk->astate, clk->state_nr - 1);
-   clk->astate = max(clk->astate, 0);
-   return nouveau_pstate_calc(clk, true);
-}
-
-int
 nouveau_clock_tstate(struct nouveau_clock *clk, int req, int rel)
 {
if (!rel) clk->tstate  = req;
-- 
1.7.10.4



[PATCH] gpu: drm: ast: ast_ttm.c: Remove unused function

2014-12-20 Thread Rickard Strandqvist
Remove the function ast_bo_unpin() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/ast/ast_drv.h |1 -
 drivers/gpu/drm/ast/ast_ttm.c |   20 
 2 files changed, 21 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 86205a2..1f8db90 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -361,7 +361,6 @@ int ast_gem_create(struct drm_device *dev,
   struct drm_gem_object **obj);

 int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr);
-int ast_bo_unpin(struct ast_bo *bo);

 static inline int ast_bo_reserve(struct ast_bo *bo, bool no_wait)
 {
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c
index 08f82ea..f7c183a 100644
--- a/drivers/gpu/drm/ast/ast_ttm.c
+++ b/drivers/gpu/drm/ast/ast_ttm.c
@@ -375,26 +375,6 @@ int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 
*gpu_addr)
return 0;
 }

-int ast_bo_unpin(struct ast_bo *bo)
-{
-   int i, ret;
-   if (!bo->pin_count) {
-   DRM_ERROR("unpin bad %p\n", bo);
-   return 0;
-   }
-   bo->pin_count--;
-   if (bo->pin_count)
-   return 0;
-
-   for (i = 0; i < bo->placement.num_placement ; i++)
-   bo->placements[i].flags &= ~TTM_PL_FLAG_NO_EVICT;
-   ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
-   if (ret)
-   return ret;
-
-   return 0;
-}
-
 int ast_bo_push_sysram(struct ast_bo *bo)
 {
int i, ret;
-- 
1.7.10.4



[PATCH] gpu: drm: radeon: radeon_atombios.c: Remove unused function

2014-12-20 Thread Rickard Strandqvist
Remove the function radeon_atom_update_memory_dll() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/radeon.h  |2 --
 drivers/gpu/drm/radeon/radeon_atombios.c |   11 ---
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index a9717b3..c5a8c53 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -328,8 +328,6 @@ bool radeon_atom_is_voltage_gpio(struct radeon_device *rdev,
 int radeon_atom_get_svi2_info(struct radeon_device *rdev,
  u8 voltage_type,
  u8 *svd_gpio_id, u8 *svc_gpio_id);
-void radeon_atom_update_memory_dll(struct radeon_device *rdev,
-  u32 mem_clock);
 void radeon_atom_set_ac_timing(struct radeon_device *rdev,
   u32 mem_clock);
 int radeon_atom_init_mc_reg_table(struct radeon_device *rdev,
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c 
b/drivers/gpu/drm/radeon/radeon_atombios.c
index df69b92..74017da 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -3027,17 +3027,6 @@ void radeon_atom_set_engine_dram_timings(struct 
radeon_device *rdev,
atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
 }

-void radeon_atom_update_memory_dll(struct radeon_device *rdev,
-  u32 mem_clock)
-{
-   u32 args;
-   int index = GetIndexIntoMasterTable(COMMAND, DynamicMemorySettings);
-
-   args = cpu_to_le32(mem_clock);  /* 10 khz */
-
-   atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t 
*)&args);
-}
-
 void radeon_atom_set_ac_timing(struct radeon_device *rdev,
   u32 mem_clock)
 {
-- 
1.7.10.4



[PATCH] gpu: drm: i915: intel_dsi_pll.c: Remove unused function

2014-12-07 Thread Rickard Strandqvist
Remove the function dsi_rr_formula() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/i915/intel_dsi_pll.c |   83 +-
 1 file changed, 1 insertion(+), 82 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_pll.c 
b/drivers/gpu/drm/i915/intel_dsi_pll.c
index fa7a6ca..20086e8 100644
--- a/drivers/gpu/drm/i915/intel_dsi_pll.c
+++ b/drivers/gpu/drm/i915/intel_dsi_pll.c
@@ -50,88 +50,7 @@ static const u32 lfsr_converts[] = {
71, 35  /* 91 - 92 */
 };

-#ifdef DSI_CLK_FROM_RR
-
-static u32 dsi_rr_formula(const struct drm_display_mode *mode,
- int pixel_format, int video_mode_format,
- int lane_count, bool eotp)
-{
-   u32 bpp;
-   u32 hactive, vactive, hfp, hsync, hbp, vfp, vsync, vbp;
-   u32 hsync_bytes, hbp_bytes, hactive_bytes, hfp_bytes;
-   u32 bytes_per_line, bytes_per_frame;
-   u32 num_frames;
-   u32 bytes_per_x_frames, bytes_per_x_frames_x_lanes;
-   u32 dsi_bit_clock_hz;
-   u32 dsi_clk;
-
-   switch (pixel_format) {
-   default:
-   case VID_MODE_FORMAT_RGB888:
-   case VID_MODE_FORMAT_RGB666_LOOSE:
-   bpp = 24;
-   break;
-   case VID_MODE_FORMAT_RGB666:
-   bpp = 18;
-   break;
-   case VID_MODE_FORMAT_RGB565:
-   bpp = 16;
-   break;
-   }
-
-   hactive = mode->hdisplay;
-   vactive = mode->vdisplay;
-   hfp = mode->hsync_start - mode->hdisplay;
-   hsync = mode->hsync_end - mode->hsync_start;
-   hbp = mode->htotal - mode->hsync_end;
-
-   vfp = mode->vsync_start - mode->vdisplay;
-   vsync = mode->vsync_end - mode->vsync_start;
-   vbp = mode->vtotal - mode->vsync_end;
-
-   hsync_bytes = DIV_ROUND_UP(hsync * bpp, 8);
-   hbp_bytes = DIV_ROUND_UP(hbp * bpp, 8);
-   hactive_bytes = DIV_ROUND_UP(hactive * bpp, 8);
-   hfp_bytes = DIV_ROUND_UP(hfp * bpp, 8);
-
-   bytes_per_line = DSI_HSS_PACKET_SIZE + hsync_bytes +
-   DSI_HSA_PACKET_EXTRA_SIZE + DSI_HSE_PACKET_SIZE +
-   hbp_bytes + DSI_HBP_PACKET_EXTRA_SIZE +
-   hactive_bytes + DSI_HACTIVE_PACKET_EXTRA_SIZE +
-   hfp_bytes + DSI_HFP_PACKET_EXTRA_SIZE;
-
-   /*
-* XXX: Need to accurately calculate LP to HS transition timeout and add
-* it to bytes_per_line/bytes_per_frame.
-*/
-
-   if (eotp && video_mode_format == VIDEO_MODE_BURST)
-   bytes_per_line += DSI_EOTP_PACKET_SIZE;
-
-   bytes_per_frame = vsync * bytes_per_line + vbp * bytes_per_line +
-   vactive * bytes_per_line + vfp * bytes_per_line;
-
-   if (eotp &&
-   (video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE ||
-video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS))
-   bytes_per_frame += DSI_EOTP_PACKET_SIZE;
-
-   num_frames = drm_mode_vrefresh(mode);
-   bytes_per_x_frames = num_frames * bytes_per_frame;
-
-   bytes_per_x_frames_x_lanes = bytes_per_x_frames / lane_count;
-
-   /* the dsi clock is divided by 2 in the hardware to get dsi ddr clock */
-   dsi_bit_clock_hz = bytes_per_x_frames_x_lanes * 8;
-   dsi_clk = dsi_bit_clock_hz / 1000;
-
-   if (eotp && video_mode_format == VIDEO_MODE_BURST)
-   dsi_clk *= 2;
-
-   return dsi_clk;
-}
-
-#else
+#ifndef DSI_CLK_FROM_RR

 /* Get DSI clock from pixel clock */
 static u32 dsi_clk_from_pclk(u32 pclk, int pixel_format, int lane_count)
-- 
1.7.10.4



[PATCH] gpu: drm: i915: intel_dsi_cmd.c: Remove unused function

2014-12-07 Thread Rickard Strandqvist
Remove the function dsi_hs_mode_enable() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/i915/intel_dsi_cmd.c |   21 -
 drivers/gpu/drm/i915/intel_dsi_cmd.h |2 --
 2 files changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.c 
b/drivers/gpu/drm/i915/intel_dsi_cmd.c
index f4767fd..71addcc 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.c
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.c
@@ -103,27 +103,6 @@ enum dsi_type {
DSI_GENERIC,
 };

-/* enable or disable command mode hs transmissions */
-void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable)
-{
-   struct drm_encoder *encoder = &intel_dsi->base.base;
-   struct drm_device *dev = encoder->dev;
-   struct drm_i915_private *dev_priv = dev->dev_private;
-   struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
-   enum pipe pipe = intel_crtc->pipe;
-   u32 temp;
-   u32 mask = DBI_FIFO_EMPTY;
-
-   if (wait_for((I915_READ(MIPI_GEN_FIFO_STAT(pipe)) & mask) == mask, 50))
-   DRM_ERROR("Timeout waiting for DBI FIFO empty\n");
-
-   temp = I915_READ(MIPI_HS_LP_DBI_ENABLE(pipe));
-   temp &= DBI_HS_LP_MODE_MASK;
-   I915_WRITE(MIPI_HS_LP_DBI_ENABLE(pipe), enable ? DBI_HS_MODE : 
DBI_LP_MODE);
-
-   intel_dsi->hs = enable;
-}
-
 static int dsi_vc_send_short(struct intel_dsi *intel_dsi, int channel,
 u8 data_type, u16 data)
 {
diff --git a/drivers/gpu/drm/i915/intel_dsi_cmd.h 
b/drivers/gpu/drm/i915/intel_dsi_cmd.h
index 46aa1ac..7ad54c0 100644
--- a/drivers/gpu/drm/i915/intel_dsi_cmd.h
+++ b/drivers/gpu/drm/i915/intel_dsi_cmd.h
@@ -36,8 +36,6 @@
 #define DPI_LP_MODE_EN false
 #define DPI_HS_MODE_EN true

-void dsi_hs_mode_enable(struct intel_dsi *intel_dsi, bool enable);
-
 int dsi_vc_dcs_write(struct intel_dsi *intel_dsi, int channel,
 const u8 *data, int len);

-- 
1.7.10.4



[PATCH] gpu: drm: i915: intel_dp.c: Remove unused function

2014-12-07 Thread Rickard Strandqvist
Remove the function intel_dp_set_drrs_state() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/i915/intel_dp.c  |   89 --
 drivers/gpu/drm/i915/intel_drv.h |1 -
 2 files changed, 90 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 5ad45bf..6df948b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4810,95 +4810,6 @@ intel_dp_init_panel_power_sequencer_registers(struct 
drm_device *dev,
  I915_READ(pp_div_reg));
 }

-void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate)
-{
-   struct drm_i915_private *dev_priv = dev->dev_private;
-   struct intel_encoder *encoder;
-   struct intel_dp *intel_dp = NULL;
-   struct intel_crtc_config *config = NULL;
-   struct intel_crtc *intel_crtc = NULL;
-   struct intel_connector *intel_connector = dev_priv->drrs.connector;
-   u32 reg, val;
-   enum edp_drrs_refresh_rate_type index = DRRS_HIGH_RR;
-
-   if (refresh_rate <= 0) {
-   DRM_DEBUG_KMS("Refresh rate should be positive non-zero.\n");
-   return;
-   }
-
-   if (intel_connector == NULL) {
-   DRM_DEBUG_KMS("DRRS supported for eDP only.\n");
-   return;
-   }
-
-   /*
-* FIXME: This needs proper synchronization with psr state. But really
-* hard to tell without seeing the user of this function of this code.
-* Check locking and ordering once that lands.
-*/
-   if (INTEL_INFO(dev)->gen < 8 && intel_edp_is_psr_enabled(dev)) {
-   DRM_DEBUG_KMS("DRRS is disabled as PSR is enabled\n");
-   return;
-   }
-
-   encoder = intel_attached_encoder(&intel_connector->base);
-   intel_dp = enc_to_intel_dp(&encoder->base);
-   intel_crtc = encoder->new_crtc;
-
-   if (!intel_crtc) {
-   DRM_DEBUG_KMS("DRRS: intel_crtc not initialized\n");
-   return;
-   }
-
-   config = &intel_crtc->config;
-
-   if (intel_dp->drrs_state.type < SEAMLESS_DRRS_SUPPORT) {
-   DRM_DEBUG_KMS("Only Seamless DRRS supported.\n");
-   return;
-   }
-
-   if (intel_connector->panel.downclock_mode->vrefresh == refresh_rate)
-   index = DRRS_LOW_RR;
-
-   if (index == intel_dp->drrs_state.refresh_rate_type) {
-   DRM_DEBUG_KMS(
-   "DRRS requested for previously set RR...ignoring\n");
-   return;
-   }
-
-   if (!intel_crtc->active) {
-   DRM_DEBUG_KMS("eDP encoder disabled. CRTC not Active\n");
-   return;
-   }
-
-   if (INTEL_INFO(dev)->gen > 6 && INTEL_INFO(dev)->gen < 8) {
-   reg = PIPECONF(intel_crtc->config.cpu_transcoder);
-   val = I915_READ(reg);
-   if (index > DRRS_HIGH_RR) {
-   val |= PIPECONF_EDP_RR_MODE_SWITCH;
-   intel_dp_set_m_n(intel_crtc);
-   } else {
-   val &= ~PIPECONF_EDP_RR_MODE_SWITCH;
-   }
-   I915_WRITE(reg, val);
-   }
-
-   /*
-* mutex taken to ensure that there is no race between differnt
-* drrs calls trying to update refresh rate. This scenario may occur
-* in future when idleness detection based DRRS in kernel and
-* possible calls from user space to set differnt RR are made.
-*/
-
-   mutex_lock(&intel_dp->drrs_state.mutex);
-
-   intel_dp->drrs_state.refresh_rate_type = index;
-
-   mutex_unlock(&intel_dp->drrs_state.mutex);
-
-   DRM_DEBUG_KMS("eDP Refresh Rate set to : %dHz\n", refresh_rate);
-}
-
 static struct drm_display_mode *
 intel_dp_drrs_init(struct intel_digital_port *intel_dig_port,
struct intel_connector *intel_connector,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ba71522..6ad239d 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -941,7 +941,6 @@ void intel_edp_panel_on(struct intel_dp *intel_dp);
 void intel_edp_panel_off(struct intel_dp *intel_dp);
 void intel_edp_psr_enable(struct intel_dp *intel_dp);
 void intel_edp_psr_disable(struct intel_dp *intel_dp);
-void intel_dp_set_drrs_state(struct drm_device *dev, int refresh_rate);
 void intel_edp_psr_invalidate(struct drm_device *dev,
  unsigned frontbuffer_bits);
 void intel_edp_psr_flush(struct drm_device *dev,
-- 
1.7.10.4



[PATCH] gpu: drm: i915: intel_display.c: Remove unused function

2014-12-07 Thread Rickard Strandqvist
Remove the function intel_output_name() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/i915/intel_display.c |   22 --
 drivers/gpu/drm/i915/intel_drv.h |1 -
 2 files changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index f0a1a56..14c47cf 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12258,28 +12258,6 @@ static bool has_edp_a(struct drm_device *dev)
return true;
 }

-const char *intel_output_name(int output)
-{
-   static const char *names[] = {
-   [INTEL_OUTPUT_UNUSED] = "Unused",
-   [INTEL_OUTPUT_ANALOG] = "Analog",
-   [INTEL_OUTPUT_DVO] = "DVO",
-   [INTEL_OUTPUT_SDVO] = "SDVO",
-   [INTEL_OUTPUT_LVDS] = "LVDS",
-   [INTEL_OUTPUT_TVOUT] = "TV",
-   [INTEL_OUTPUT_HDMI] = "HDMI",
-   [INTEL_OUTPUT_DISPLAYPORT] = "DisplayPort",
-   [INTEL_OUTPUT_EDP] = "eDP",
-   [INTEL_OUTPUT_DSI] = "DSI",
-   [INTEL_OUTPUT_UNKNOWN] = "Unknown",
-   };
-
-   if (output < 0 || output >= ARRAY_SIZE(names) || !names[output])
-   return "Invalid";
-
-   return names[output];
-}
-
 static bool intel_crt_present(struct drm_device *dev)
 {
struct drm_i915_private *dev_priv = dev->dev_private;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ba71522..7dde496 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -793,7 +793,6 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);

 /* intel_display.c */
-const char *intel_output_name(int output);
 bool intel_has_pending_fb_unpin(struct drm_device *dev);
 int intel_pch_rawclk(struct drm_device *dev);
 void intel_mark_busy(struct drm_device *dev);
-- 
1.7.10.4



[PATCH] gpu: drm: i915: intel_sideband.c: Remove some unused functions

2014-12-07 Thread Rickard Strandqvist
Removes some functions that are not used anywhere:
vlv_flisdsi_read() vlv_gps_core_write() vlv_gps_core_read()
vlv_ccu_write() vlv_ccu_read() vlv_gpio_nc_read()

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/i915/i915_drv.h   |6 -
 drivers/gpu/drm/i915/intel_sideband.c |   44 -
 2 files changed, 50 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 16a6f6d..d248957 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2849,23 +2849,17 @@ int sandybridge_pcode_write(struct drm_i915_private 
*dev_priv, u8 mbox, u32 val)
 u32 vlv_punit_read(struct drm_i915_private *dev_priv, u8 addr);
 void vlv_punit_write(struct drm_i915_private *dev_priv, u8 addr, u32 val);
 u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr);
-u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg);
 void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
 u32 vlv_cck_read(struct drm_i915_private *dev_priv, u32 reg);
 void vlv_cck_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg);
-void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
 u32 vlv_bunit_read(struct drm_i915_private *dev_priv, u32 reg);
 void vlv_bunit_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
-u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg);
-void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);
 u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg);
 void vlv_dpio_write(struct drm_i915_private *dev_priv, enum pipe pipe, int 
reg, u32 val);
 u32 intel_sbi_read(struct drm_i915_private *dev_priv, u16 reg,
   enum intel_sbi_destination destination);
 void intel_sbi_write(struct drm_i915_private *dev_priv, u16 reg, u32 value,
 enum intel_sbi_destination destination);
-u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg);
 void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val);

 int vlv_gpu_freq(struct drm_i915_private *dev_priv, int val);
diff --git a/drivers/gpu/drm/i915/intel_sideband.c 
b/drivers/gpu/drm/i915/intel_sideband.c
index 01d841e..5939171 100644
--- a/drivers/gpu/drm/i915/intel_sideband.c
+++ b/drivers/gpu/drm/i915/intel_sideband.c
@@ -129,14 +129,6 @@ u32 vlv_nc_read(struct drm_i915_private *dev_priv, u8 addr)
return val;
 }

-u32 vlv_gpio_nc_read(struct drm_i915_private *dev_priv, u32 reg)
-{
-   u32 val = 0;
-   vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPIO_NC,
-   SB_CRRDDA_NP, reg, &val);
-   return val;
-}
-
 void vlv_gpio_nc_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPIO_NC,
@@ -157,34 +149,6 @@ void vlv_cck_write(struct drm_i915_private *dev_priv, u32 
reg, u32 val)
SB_CRWRDA_NP, reg, &val);
 }

-u32 vlv_ccu_read(struct drm_i915_private *dev_priv, u32 reg)
-{
-   u32 val = 0;
-   vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCU,
-   SB_CRRDDA_NP, reg, &val);
-   return val;
-}
-
-void vlv_ccu_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
-{
-   vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_CCU,
-   SB_CRWRDA_NP, reg, &val);
-}
-
-u32 vlv_gps_core_read(struct drm_i915_private *dev_priv, u32 reg)
-{
-   u32 val = 0;
-   vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPS_CORE,
-   SB_CRRDDA_NP, reg, &val);
-   return val;
-}
-
-void vlv_gps_core_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
-{
-   vlv_sideband_rw(dev_priv, PCI_DEVFN(2, 0), IOSF_PORT_GPS_CORE,
-   SB_CRWRDA_NP, reg, &val);
-}
-
 u32 vlv_dpio_read(struct drm_i915_private *dev_priv, enum pipe pipe, int reg)
 {
u32 val = 0;
@@ -267,14 +231,6 @@ void intel_sbi_write(struct drm_i915_private *dev_priv, 
u16 reg, u32 value,
}
 }

-u32 vlv_flisdsi_read(struct drm_i915_private *dev_priv, u32 reg)
-{
-   u32 val = 0;
-   vlv_sideband_rw(dev_priv, DPIO_DEVFN, IOSF_PORT_FLISDSI, SB_CRRDDA_NP,
-   reg, &val);
-   return val;
-}
-
 void vlv_flisdsi_write(struct drm_i915_private *dev_priv, u32 reg, u32 val)
 {
vlv_sideband_rw(dev_priv, DPIO_DEVFN, IOSF_PORT_FLISDSI, SB_CRWRDA_NP,
-- 
1.7.10.4



[PATCH] gpu: drm: gma500: tc35876x-dsi-lvds.c: Remove unused function

2014-12-07 Thread Rickard Strandqvist
Remove the function tc35876x_exit() that is not used anywhere.

This was partially found by using a static code analysis program called 
cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c |   10 --
 drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h |1 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c 
b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
index 771ff66..3def842 100644
--- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
+++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.c
@@ -817,13 +817,3 @@ void tc35876x_init(struct drm_device *dev)

tc35876x_brightness_init(dev);
 }
-
-void tc35876x_exit(void)
-{
-   pr_debug("%s\n", __func__);
-
-   i2c_del_driver(&tc35876x_bridge_i2c_driver);
-
-   if (cmi_lcd_i2c_client)
-   i2c_del_driver(&cmi_lcd_i2c_driver);
-}
diff --git a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h 
b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h
index b14b7f9..cf9d6bb 100644
--- a/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h
+++ b/drivers/gpu/drm/gma500/tc35876x-dsi-lvds.h
@@ -31,7 +31,6 @@ void tc35876x_brightness_control(struct drm_device *dev, int 
level);
 void tc35876x_toshiba_bridge_panel_off(struct drm_device *dev);
 void tc35876x_toshiba_bridge_panel_on(struct drm_device *dev);
 void tc35876x_init(struct drm_device *dev);
-void tc35876x_exit(void);

 extern const struct panel_funcs mdfld_tc35876x_funcs;

-- 
1.7.10.4



[PATCH v2] gpu: drm: drm_dp_mst_topology.c: Fix improper use of strncat

2014-10-12 Thread Rickard Strandqvist
Fixed wrong usage of strncat, switched to strlcpy.
While sending the string size to function to reduce
the potential for misuse in future.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/drm_dp_mst_topology.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index ac3c273..2a146d1 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -995,19 +995,20 @@ static void drm_dp_check_port_guid(struct 
drm_dp_mst_branch *mstb,

 static void build_mst_prop_path(struct drm_dp_mst_port *port,
struct drm_dp_mst_branch *mstb,
-   char *proppath)
+   char *proppath,
+   size_t proppath_size)
 {
int i;
char temp[8];
-   snprintf(proppath, 255, "mst:%d", mstb->mgr->conn_base_id);
+   snprintf(proppath, proppath_size, "mst:%d", mstb->mgr->conn_base_id);
for (i = 0; i < (mstb->lct - 1); i++) {
int shift = (i % 2) ? 0 : 4;
int port_num = mstb->rad[i / 2] >> shift;
-   snprintf(temp, 8, "-%d", port_num);
-   strncat(proppath, temp, 255);
+   snprintf(temp, sizeof(temp), "-%d", port_num);
+   strlcat(proppath, temp, proppath_size);
}
-   snprintf(temp, 8, "-%d", port->port_num);
-   strncat(proppath, temp, 255);
+   snprintf(temp, sizeof(temp), "-%d", port->port_num);
+   strlcat(proppath, temp, proppath_size);
 }

 static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
@@ -1078,7 +1079,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch 
*mstb,

if (created && !port->input) {
char proppath[255];
-   build_mst_prop_path(port, mstb, proppath);
+   build_mst_prop_path(port, mstb, proppath, sizeof(proppath));
port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, 
port, proppath);
}

-- 
1.7.10.4



[PATCH] gpu: drm: drm_dp_mst_topology.c: Fix improper use of strncat.

2014-10-05 Thread Rickard Strandqvist
I have now eliminate the need to use the temporary string,
and therefore also the use of strncat.
And I think this code is clearer and more effective.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/drm_dp_mst_topology.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index ac3c273..c3f6571 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -997,17 +997,18 @@ static void build_mst_prop_path(struct drm_dp_mst_port 
*port,
struct drm_dp_mst_branch *mstb,
char *proppath)
 {
-   int i;
-   char temp[8];
-   snprintf(proppath, 255, "mst:%d", mstb->mgr->conn_base_id);
+   int i, len;
+   static const int proppath_len = 255;
+   memset(proppath, 0, proppath_len);
+   len = snprintf(proppath, proppath_len, "mst:%d", 
mstb->mgr->conn_base_id);
for (i = 0; i < (mstb->lct - 1); i++) {
int shift = (i % 2) ? 0 : 4;
int port_num = mstb->rad[i / 2] >> shift;
-   snprintf(temp, 8, "-%d", port_num);
-   strncat(proppath, temp, 255);
+   len += snprintf(&proppath[(len < proppath_len ? len : 0)],
+   proppath_len - len, "-%d", 
port_num);
}
-   snprintf(temp, 8, "-%d", port->port_num);
-   strncat(proppath, temp, 255);
+   snprintf(&proppath[(len < proppath_len ? len : 0)], proppath_len - len,
+   "-%d", port->port_num);
 }

 static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
-- 
1.7.10.4



[PATCH] gpu: drm: radeon: r600_cp.c: Cleaning up uninitialized variables

2014-06-02 Thread Rickard Strandqvist
Hi

Thanks for your response!

No, it does not sound like it's worth changing anything.
Although in the worst case with this patch you probably have a more
consistent error :)



Best regards
Rickard Strandqvist


2014-06-02 9:48 GMT+02:00 Christian K?nig :
> Am 01.06.2014 01:10, schrieb Rickard Strandqvist:
>
>> There is a risk that the variable will be used without being initialized.
>>
>> This was largely found by using a static code analysis program called
>> cppcheck.
>>
>> Signed-off-by: Rickard Strandqvist
>> 
>
>
> On the one hand it looks like a valid fix to me, but on the other hand the
> r600_cp.c code is deprecated for something like five years now.
>
> I would like to avoid touching it in any way and just let it rest peacefully
> until we can remove it entirely.
>
> Christian.
>
>
>> ---
>>   drivers/gpu/drm/radeon/r600_cp.c |2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/radeon/r600_cp.c
>> b/drivers/gpu/drm/radeon/r600_cp.c
>> index 8c9b7e2..0770ad6 100644
>> --- a/drivers/gpu/drm/radeon/r600_cp.c
>> +++ b/drivers/gpu/drm/radeon/r600_cp.c
>> @@ -2615,7 +2615,7 @@ int r600_cs_legacy_ioctl(struct drm_device *dev,
>> void *data, struct drm_file *fp
>> struct drm_radeon_cs *cs = data;
>> struct drm_buf *buf;
>> unsigned family;
>> -   int l, r = 0;
>> +   int l = 0, r = 0;
>> u32 *ib, cs_id = 0;
>> if (dev_priv == NULL) {
>
>


[PATCH] gpu: drm: radeon: r600_cp.c: Cleaning up uninitialized variables

2014-06-01 Thread Rickard Strandqvist
There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist 
---
 drivers/gpu/drm/radeon/r600_cp.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c
index 8c9b7e2..0770ad6 100644
--- a/drivers/gpu/drm/radeon/r600_cp.c
+++ b/drivers/gpu/drm/radeon/r600_cp.c
@@ -2615,7 +2615,7 @@ int r600_cs_legacy_ioctl(struct drm_device *dev, void 
*data, struct drm_file *fp
struct drm_radeon_cs *cs = data;
struct drm_buf *buf;
unsigned family;
-   int l, r = 0;
+   int l = 0, r = 0;
u32 *ib, cs_id = 0;

if (dev_priv == NULL) {
-- 
1.7.10.4