Skip to contentSkip to conversation

Another shot at cruft removal

PATCH Applied Daniel Vetter 7 participants 30 messages Mar 30, 2016 – Apr 26, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Another shot at cruft removal

Hi all,

Found this pile of cruft removal patches hiding. Bunch of them have been posted already a few times, most of them are variations of the "hide dev->struct_mutex" theme.

Feedback and review highly welcome, I'd like to get them all in.

Thanks, Daniel

Daniel Vetter (10):
drm/ttm: Remove TTM_HAS_AGP
drm: Use dev->name as fallback for dev->unique drm/sysfs: Annote lockless show functions with READ_ONCE drm/sysfs: Nuke TV/DVI property files
drm: Give drm_agp_clear drm_legacy_ prefix
drm: Put legacy lastclose work into drm_legacy_dev_reinit
drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix
drm: Forbid legacy MAP functions for DRIVER_MODESET
drm: Push struct_mutex into ->master_destroy
drm: Hide master MAP cleanup in drm_bufs.c

 drivers/gpu/drm/Kconfig                  |   1 +
 drivers/gpu/drm/drm_agpsupport.c         |   4 +-
 drivers/gpu/drm/drm_bufs.c               |  92 ++++++++++++++++-
 drivers/gpu/drm/drm_drv.c                |  10 +-
 drivers/gpu/drm/drm_fops.c               |  42 ++++----
 drivers/gpu/drm/drm_internal.h           |   2 +-
 drivers/gpu/drm/drm_ioctl.c              |  66 ++----------
 drivers/gpu/drm/drm_legacy.h             |   2 +
 drivers/gpu/drm/drm_pci.c                |   2 +-
 drivers/gpu/drm/drm_sysfs.c              | 167 ++-----------------------------
 drivers/gpu/drm/ttm/Makefile             |   3 +-
 drivers/gpu/drm/ttm/ttm_agp_backend.c    |   3 -
 drivers/gpu/drm/ttm/ttm_page_alloc.c     |   8 +-
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c |   8 +-
 drivers/gpu/drm/vgem/vgem_drv.c          |   2 -
 include/drm/drm_agpsupport.h             |   4 +-
 include/drm/drm_legacy.h                 |   4 +-
 include/drm/ttm/ttm_bo_driver.h          |   3 +-
 18 files changed, 145 insertions(+), 278 deletions(-)
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/10 drm/ttm: Remove TTM_HAS_AGP

It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/Kconfig                  | 1 +
 drivers/gpu/drm/ttm/Makefile             | 3 ++-
 drivers/gpu/drm/ttm/ttm_agp_backend.c    | 3 ---
 drivers/gpu/drm/ttm/ttm_page_alloc.c     | 8 ++++----
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
 include/drm/ttm/ttm_bo_driver.h          | 3 +--
 6 files changed, 12 insertions(+), 14 deletions(-)
drivers/gpu/drm/Kconfig +1 -0
index f2a74d0b68ae..7c9fc451f1aa 100644
@@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE
 config DRM_TTM
 	tristate
 	depends on DRM
+	depends on (AGP || AGP=n)
 	help
 	  GPU memory management subsystem for devices with multiple
 	  GPU memory types. Will be enabled automatically if a device driver
drivers/gpu/drm/ttm/Makefile +2 -1
index b433b9f040c9..f92325800f8a 100644
@@ -2,9 +2,10 @@
 # Makefile for the drm device driver.  This driver provides support for the
 
 ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
 	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
 	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
 	ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_agp_backend.c +0 -3
index 764be36397fd..028ab6007873 100644
@@ -34,7 +34,6 @@
 #include <drm/ttm/ttm_module.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
 #include <drm/ttm/ttm_placement.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
 	ttm_pool_unpopulate(ttm);
 }
 EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
drivers/gpu/drm/ttm/ttm_page_alloc.c +4 -4
index 025c429050c0..a37de5db5731 100644
@@ -48,7 +48,7 @@
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
 
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +4 -4
index 624d941aaad1..bef9f6feb635 100644
@@ -50,7 +50,7 @@
 #include <linux/kthread.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
include/drm/ttm/ttm_bo_driver.h +1 -2
index 3d4bf08aa21f..ff544e3e37a7 100644
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 
 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
 
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#ifdef CONFIG_AGP
 #include <linux/agp_backend.h>
 
 /**
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP

drivers/gpu/drm/Kconfig config DRM_LOAD_EDID_FIRMWARE · line 86

Quoted 7 lines · Daniel Vetter
drivers/gpu/drm/Kconfig +1 -0
@@ -83,6 +83,7 @@ config DRM_LOAD_EDID_FIRMWARE
 config DRM_TTM
        tristate
        depends on DRM
+       depends on (AGP || AGP=n)

Already part of config DRM, so we don't need it here ?

include/drm/ttm/ttm_bo_driver.h extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp); · line 1033

Quoted 9 lines
include/drm/ttm/ttm_bo_driver.h +1 -2
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 
 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
 
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#ifdef CONFIG_AGP

#if IS_ENABLED(CONFIG_AGP) ?

-Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [Intel-gfx] [PATCH 01/10] drm/ttm: Remove TTM_HAS_AGP

In reply to Daniel Vetter
reproduce:

Hi Daniel,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_create':

>> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration]
      return ttm_agp_tt_create(bdev, drm->agp.bridge, size,
             ^
>> drivers/gpu/drm/nouveau/nouveau_bo.c:581:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
   drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_populate':
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1501:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration]
      return ttm_agp_tt_populate(ttm);
             ^
   drivers/gpu/drm/nouveau/nouveau_bo.c: In function 'nouveau_ttm_tt_unpopulate':
>> drivers/gpu/drm/nouveau/nouveau_bo.c:1568:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration]
      ttm_agp_tt_unpopulate(ttm);
      ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_create':
>> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: error: implicit declaration of function 'ttm_agp_tt_create' [-Werror=implicit-function-declaration]
      return ttm_agp_tt_create(bdev, rdev->ddev->agp->bridge,
             ^
>> drivers/gpu/drm/radeon/radeon_ttm.c:685:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
   drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_populate':
>> drivers/gpu/drm/radeon/radeon_ttm.c:741:10: error: implicit declaration of function 'ttm_agp_tt_populate' [-Werror=implicit-function-declaration]
      return ttm_agp_tt_populate(ttm);
             ^
   drivers/gpu/drm/radeon/radeon_ttm.c: In function 'radeon_ttm_tt_unpopulate':
>> drivers/gpu/drm/radeon/radeon_ttm.c:792:3: error: implicit declaration of function 'ttm_agp_tt_unpopulate' [-Werror=implicit-function-declaration]
      ttm_agp_tt_unpopulate(ttm);
      ^

cc1: some warnings being treated as errors

vim +/ttm_agp_tt_unpopulate +1568 drivers/gpu/drm/nouveau/nouveau_bo.c

26c9e8eff Ben Skeggs            2015-08-20  1495  	if (!nvxx_device(&drm->device)->func->cpu_coherent &&
c3a0c771e Alexandre Courbot     2014-10-27  1496  	    ttm->caching_state == tt_uncached)
c3a0c771e Alexandre Courbot     2014-10-27  1497  		return ttm_dma_populate(ttm_dma, dev->dev);
c3a0c771e Alexandre Courbot     2014-10-27  1498  
a7fb8a23c Daniel Vetter         2015-09-09  1499  #if IS_ENABLED(CONFIG_AGP)
340b0e7c5 Ben Skeggs            2015-08-20  1500  	if (drm->agp.bridge) {
dea7e0ac4 Jerome Glisse         2012-01-03 @1501  		return ttm_agp_tt_populate(ttm);
dea7e0ac4 Jerome Glisse         2012-01-03  1502  	}
dea7e0ac4 Jerome Glisse         2012-01-03  1503  #endif
dea7e0ac4 Jerome Glisse         2012-01-03  1504  
9bcd38de5 Alexandre Courbot     2016-03-02  1505  #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1506  	if (swiotlb_nr_tbl()) {
8e7e70522 Jerome Glisse         2011-11-09  1507  		return ttm_dma_populate((void *)ttm, dev->dev);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1508  	}
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1509  #endif
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1510  
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1511  	r = ttm_pool_populate(ttm);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1512  	if (r) {
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1513  		return r;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1514  	}
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1515  
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1516  	for (i = 0; i < ttm->num_pages; i++) {
fd1496a0f Alexandre Courbot     2014-07-31  1517  		dma_addr_t addr;
fd1496a0f Alexandre Courbot     2014-07-31  1518  
fd1496a0f Alexandre Courbot     2014-07-31  1519  		addr = dma_map_page(pdev, ttm->pages[i], 0, PAGE_SIZE,
fd1496a0f Alexandre Courbot     2014-07-31  1520  				    DMA_BIDIRECTIONAL);
fd1496a0f Alexandre Courbot     2014-07-31  1521  
fd1496a0f Alexandre Courbot     2014-07-31  1522  		if (dma_mapping_error(pdev, addr)) {
4fbbed46d Rasmus Villemoes      2016-02-15  1523  			while (i--) {
fd1496a0f Alexandre Courbot     2014-07-31  1524  				dma_unmap_page(pdev, ttm_dma->dma_address[i],
fd1496a0f Alexandre Courbot     2014-07-31  1525  					       PAGE_SIZE, DMA_BIDIRECTIONAL);
8e7e70522 Jerome Glisse         2011-11-09  1526  				ttm_dma->dma_address[i] = 0;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1527  			}
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1528  			ttm_pool_unpopulate(ttm);
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1529  			return -EFAULT;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1530  		}
fd1496a0f Alexandre Courbot     2014-07-31  1531  
fd1496a0f Alexandre Courbot     2014-07-31  1532  		ttm_dma->dma_address[i] = addr;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1533  	}
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1534  	return 0;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1535  }
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1536  
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1537  static void
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1538  nouveau_ttm_tt_unpopulate(struct ttm_tt *ttm)
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1539  {
8e7e70522 Jerome Glisse         2011-11-09  1540  	struct ttm_dma_tt *ttm_dma = (void *)ttm;
ebb945a94 Ben Skeggs            2012-07-20  1541  	struct nouveau_drm *drm;
be83cd4ef Ben Skeggs            2015-01-14  1542  	struct nvkm_device *device;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1543  	struct drm_device *dev;
fd1496a0f Alexandre Courbot     2014-07-31  1544  	struct device *pdev;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1545  	unsigned i;
22b33e8ed Dave Airlie           2012-04-02  1546  	bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
22b33e8ed Dave Airlie           2012-04-02  1547  
22b33e8ed Dave Airlie           2012-04-02  1548  	if (slave)
22b33e8ed Dave Airlie           2012-04-02  1549  		return;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1550  
ebb945a94 Ben Skeggs            2012-07-20  1551  	drm = nouveau_bdev(ttm->bdev);
989aa5b76 Ben Skeggs            2015-01-12  1552  	device = nvxx_device(&drm->device);
ebb945a94 Ben Skeggs            2012-07-20  1553  	dev = drm->dev;
26c9e8eff Ben Skeggs            2015-08-20  1554  	pdev = device->dev;
3230cfc34 Konrad Rzeszutek Wilk 2011-10-17  1555  
c3a0c771e Alexandre Courbot     2014-10-27  1556  	/*
c3a0c771e Alexandre Courbot     2014-10-27  1557  	 * Objects matching this condition have been marked as force_coherent,
c3a0c771e Alexandre Courbot     2014-10-27  1558  	 * so use the DMA API for them.
c3a0c771e Alexandre Courbot     2014-10-27  1559  	 */
26c9e8eff Ben Skeggs            2015-08-20  1560  	if (!nvxx_device(&drm->device)->func->cpu_coherent &&
dcccdc143 Alexandre Courbot     2014-12-11  1561  	    ttm->caching_state == tt_uncached) {
c3a0c771e Alexandre Courbot     2014-10-27  1562  		ttm_dma_unpopulate(ttm_dma, dev->dev);
dcccdc143 Alexandre Courbot     2014-12-11  1563  		return;
dcccdc143 Alexandre Courbot     2014-12-11  1564  	}
c3a0c771e Alexandre Courbot     2014-10-27  1565  
a7fb8a23c Daniel Vetter         2015-09-09  1566  #if IS_ENABLED(CONFIG_AGP)
340b0e7c5 Ben Skeggs            2015-08-20  1567  	if (drm->agp.bridge) {
dea7e0ac4 Jerome Glisse         2012-01-03 @1568  		ttm_agp_tt_unpopulate(ttm);
dea7e0ac4 Jerome Glisse         2012-01-03  1569  		return;
dea7e0ac4 Jerome Glisse         2012-01-03  1570  	}
dea7e0ac4 Jerome Glisse         2012-01-03  1571  #endif

:::::: The code at line 1568 was first introduced by commit
:::::: dea7e0ac45fd28f90bbc38ff226d36a9f788efbf ttm: fix agp since ttm tt rework

:::::: TO: Jerome Glisse <[email protected]>
:::::: CC: Dave Airlie <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH 1/1 drm/ttm: Remove TTM_HAS_AGP

In reply to Daniel Vetter

It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

Cc Emil Velikov <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/ttm/Makefile             | 3 ++-
 drivers/gpu/drm/ttm/ttm_agp_backend.c    | 3 ---
 drivers/gpu/drm/ttm/ttm_page_alloc.c     | 8 ++++----
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
 include/drm/ttm/ttm_bo_driver.h          | 3 +--
 5 files changed, 11 insertions(+), 14 deletions(-)
drivers/gpu/drm/ttm/Makefile +2 -1
index b433b9f040c9..f92325800f8a 100644
@@ -2,9 +2,10 @@
 # Makefile for the drm device driver.  This driver provides support for the
 
 ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
 	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
 	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
 	ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_agp_backend.c +0 -3
index 764be36397fd..028ab6007873 100644
@@ -34,7 +34,6 @@
 #include <drm/ttm/ttm_module.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
 #include <drm/ttm/ttm_placement.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
 	ttm_pool_unpopulate(ttm);
 }
 EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
drivers/gpu/drm/ttm/ttm_page_alloc.c +4 -4
index 025c429050c0..a37de5db5731 100644
@@ -48,7 +48,7 @@
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
 
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +4 -4
index 624d941aaad1..bef9f6feb635 100644
@@ -50,7 +50,7 @@
 #include <linux/kthread.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
include/drm/ttm/ttm_bo_driver.h +1 -2
index 3d4bf08aa21f..19b39cc2dcaa 100644
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 
 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
 
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#ifdef IS_ENABLED(CONFIG_AGP)
 #include <linux/agp_backend.h>
 
 /**
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

Re: [Intel-gfx] [PATCH] drm/ttm: Remove TTM_HAS_AGP

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Daniel,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-ttm-Remove-TTM_HAS_AGP/20160330-191030
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: sparc64-allyesconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64

All warnings (new ones prefixed by >>):

In file included from include/drm/ttm/ttm_page_alloc.h:29:0,
from drivers/gpu/drm/ttm/ttm_memory.c:32:

>> include/drm/ttm/ttm_bo_driver.h:1033:18: warning: extra tokens at end of #ifdef directive
    #ifdef IS_ENABLED(CONFIG_AGP)
                     ^
   In file included from include/drm/ttm/ttm_page_alloc.h:29:0,
                    from drivers/gpu/drm/ttm/ttm_memory.c:32:
>> include/drm/ttm/ttm_bo_driver.h:1033:18: warning: extra tokens at end of #ifdef directive
    #ifdef IS_ENABLED(CONFIG_AGP)
                     ^

vim +1033 include/drm/ttm/ttm_bo_driver.h

  1017					     struct fence *fence,
  1018					     bool evict, bool no_wait_gpu,
  1019					     struct ttm_mem_reg *new_mem);
  1020	/**
  1021	 * ttm_io_prot
  1022	 *
  1023	 * @c_state: Caching state.
  1024	 * @tmp: Page protection flag for a normal, cached mapping.
  1025	 *
  1026	 * Utility function that returns the pgprot_t that should be used for
  1027	 * setting up a PTE with the caching model indicated by @c_state.
  1028	 */
  1029	extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
  1030	
  1031	extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
  1032	
> 1033	#ifdef IS_ENABLED(CONFIG_AGP)

1034 #include <linux/agp_backend.h>
1035
1036 /**
1037 * ttm_agp_tt_create
1038 *
1039 * @bdev: Pointer to a struct ttm_bo_device.
1040 * @bridge: The agp bridge this device is sitting on.
1041 * @size: Size of the data needed backing.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

PATCH 1/1 drm/ttm: Remove TTM_HAS_AGP

In reply to Daniel Vetter

It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

v4: Actually get it right as spotted by 0-day.

Cc Emil Velikov <[email protected]>
Cc Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/ttm/Makefile             | 3 ++-
 drivers/gpu/drm/ttm/ttm_agp_backend.c    | 3 ---
 drivers/gpu/drm/ttm/ttm_page_alloc.c     | 8 ++++----
 drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 8 ++++----
 include/drm/ttm/ttm_bo_driver.h          | 3 +--
 5 files changed, 11 insertions(+), 14 deletions(-)
drivers/gpu/drm/ttm/Makefile +2 -1
index b433b9f040c9..f92325800f8a 100644
@@ -2,9 +2,10 @@
 # Makefile for the drm device driver.  This driver provides support for the
 
 ccflags-y := -Iinclude/drm
-ttm-y := ttm_agp_backend.o ttm_memory.o ttm_tt.o ttm_bo.o \
+ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
 	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
 	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
 	ttm_bo_manager.o ttm_page_alloc_dma.o
+ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
 obj-$(CONFIG_DRM_TTM) += ttm.o
drivers/gpu/drm/ttm/ttm_agp_backend.c +0 -3
index 764be36397fd..028ab6007873 100644
@@ -34,7 +34,6 @@
 #include <drm/ttm/ttm_module.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
 #include <drm/ttm/ttm_placement.h>
 #include <linux/agp_backend.h>
 #include <linux/module.h>
@@ -148,5 +147,3 @@ void ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
 	ttm_pool_unpopulate(ttm);
 }
 EXPORT_SYMBOL(ttm_agp_tt_unpopulate);
-
-#endif
drivers/gpu/drm/ttm/ttm_page_alloc.c +4 -4
index 025c429050c0..a37de5db5731 100644
@@ -48,7 +48,7 @@
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
 
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -219,7 +219,7 @@ static struct ttm_pool_manager *_manager;
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -230,7 +230,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -241,7 +241,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +4 -4
index 624d941aaad1..bef9f6feb635 100644
@@ -50,7 +50,7 @@
 #include <linux/kthread.h>
 #include <drm/ttm/ttm_bo_driver.h>
 #include <drm/ttm/ttm_page_alloc.h>
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <asm/agp.h>
 #endif
 
@@ -271,7 +271,7 @@ static struct kobj_type ttm_pool_kobj_type = {
 #ifndef CONFIG_X86
 static int set_pages_array_wb(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -282,7 +282,7 @@ static int set_pages_array_wb(struct page **pages, int addrinarray)
 
 static int set_pages_array_wc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
@@ -293,7 +293,7 @@ static int set_pages_array_wc(struct page **pages, int addrinarray)
 
 static int set_pages_array_uc(struct page **pages, int addrinarray)
 {
-#ifdef TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 	int i;
 
 	for (i = 0; i < addrinarray; i++)
include/drm/ttm/ttm_bo_driver.h +1 -2
index 3d4bf08aa21f..cb91f80c15b3 100644
@@ -1030,8 +1030,7 @@ extern pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 
 extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
 
-#if (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
-#define TTM_HAS_AGP
+#if IS_ENABLED(CONFIG_AGP)
 #include <linux/agp_backend.h>
 
 /**
Signature · 6 lines
2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#7 lore raw

Re: [PATCH] drm/ttm: Remove TTM_HAS_AGP

Quoted 4 lines · Daniel Vetter

It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere.

Quoted 9 lines

Also use the neat Makefile magic to make the entire ttm_agp_backend file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

v4: Actually get it right as spotted by 0-day.

Nice one. I didn't even spot the typo/thinko in v3 ;-)

Quoted 3 lines
Cc Emil Velikov <[email protected]>
Cc Ville Syrjälä <[email protected]>

-Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#8 lore raw

Re: [PATCH] drm/ttm: Remove TTM_HAS_AGP

Quoted 12 lines · Emil Velikov
Quoted 11 lines · Daniel Vetter

It tries to do fancy things with excluding agp support if ttm is built-in, but agp isn't. Instead just express this depency like drm does and use CONFIG_AGP everywhere.

Also use the neat Makefile magic to make the entire ttm_agp_backend file optional.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Review from Emil.

Quoted 8 lines
Quoted 2 lines

v4: Actually get it right as spotted by 0-day.

Nice one. I didn't even spot the typo/thinko in v3 ;-)

Quoted 3 lines
Cc Emil Velikov <[email protected]>
Cc Ville Syrjälä <[email protected]>

Applied to drm-misc, thanks for the review.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 2/10 drm: Use dev->name as fallback for dev->unique

In reply to Daniel Vetter

Lots of arm drivers get this wrong and for most arm boards this is the right thing actually. And anyway with most loaders you want to chase sysfs links anyway to figure out which dri device you want.

This will fix dmesg noise for rockchip and sti.

---
 drivers/gpu/drm/drm_ioctl.c     | 12 +++++-------
 drivers/gpu/drm/vgem/vgem_drv.c |  2 --
 2 files changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_ioctl.c +5 -7
index 8ce2a0c59116..3ecd1368c23a 100644
@@ -134,16 +134,14 @@ static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
 			drm_unset_busid(dev, master);
 			return ret;
 		}
-	} else {
-		if (WARN(dev->unique == NULL,
-			 "No drm_driver.set_busid() implementation provided by "
-			 "%ps. Use drm_dev_set_unique() to set the unique "
-			 "name explicitly.", dev->driver))
-			return -EINVAL;
-
+	} else if (dev->unique) {
 		master->unique = kstrdup(dev->unique, GFP_KERNEL);
 		if (master->unique)
 			master->unique_len = strlen(dev->unique);
+	} else {
+		master->unique = kstrdup(dev->driver->name, GFP_KERNEL);
+		if (master->unique)
+			master->unique_len = strlen(dev->driver->name);
 	}
 
 	return 0;
drivers/gpu/drm/vgem/vgem_drv.c +0 -2
index ae4de36d1d83..d61a547fa3c9 100644
@@ -260,8 +260,6 @@ static int __init vgem_init(void)
 		goto out;
 	}
 
-	drm_dev_set_unique(vgem_device, "vgem");
-
 	ret  = drm_dev_register(vgem_device, 0);
 
 	if (ret)
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

Re: [PATCH 02/10] drm: Use dev->name as fallback for dev->unique

Quoted 6 lines · Daniel Vetter

Lots of arm drivers get this wrong and for most arm boards this is the right thing actually. And anyway with most loaders you want to chase sysfs links anyway to figure out which dri device you want.

This will fix dmesg noise for rockchip and sti.

Fwiw I still hope to finish libdrm-2 (hint importing kernel headers), which will remove the biggest user of these legacy ioctls. This way we might even nuke all these lovelies from the kernel. I doubt you'll object against the idea, will you ?

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#11 lore raw

Re: [PATCH 02/10] drm: Use dev->name as fallback for dev->unique

Quoted 11 lines · Emil Velikov
Quoted 6 lines · Daniel Vetter

Lots of arm drivers get this wrong and for most arm boards this is the right thing actually. And anyway with most loaders you want to chase sysfs links anyway to figure out which dri device you want.

This will fix dmesg noise for rockchip and sti.

Fwiw I still hope to finish libdrm-2 (hint importing kernel headers), which will remove the biggest user of these legacy ioctls. This way we might even nuke all these lovelies from the kernel. I doubt you'll object against the idea, will you ?

We can't nuke this lovelies from the kernel for another 5-10 years since old userspace needs to keep working :(

Feel like r-b-stamping this patch?
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH 3/10 drm/sysfs: Annote lockless show functions with READ_ONCE

In reply to Daniel Vetter

For documentation and paranoia.

---
 drivers/gpu/drm/drm_sysfs.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_sysfs.c +8 -3
index d503f8e8c2d1..43875cb35691 100644
@@ -208,9 +208,12 @@ static ssize_t status_show(struct device *device,
 			   char *buf)
 {
 	struct drm_connector *connector = to_drm_connector(device);
+	enum drm_connector_status status;
+
+	status = READ_ONCE(connector->status);
 
 	return snprintf(buf, PAGE_SIZE, "%s\n",
-			drm_get_connector_status_name(connector->status));
+			drm_get_connector_status_name(status));
 }
 
 static ssize_t dpms_show(struct device *device,
@@ -231,9 +234,11 @@ static ssize_t enabled_show(struct device *device,
 			   char *buf)
 {
 	struct drm_connector *connector = to_drm_connector(device);
+	bool enabled;
+
+	enabled = READ_ONCE(connector->encoder);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
-			"disabled");
+	return snprintf(buf, PAGE_SIZE, enabled ? "enabled\n" : "disabled\n");
 }
 
 static ssize_t edid_show(struct file *filp, struct kobject *kobj,
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

Re: [PATCH 03/10] drm/sysfs: Annote lockless show functions with READ_ONCE

Quoted 3 lines · Daniel Vetter

For documentation and paranoia.

Merged to drm-misc with Chris' irc ack - we just discussed the opposite WRITE_ONCE in some other patches.
-Daniel

Quoted 39 lines
---
 drivers/gpu/drm/drm_sysfs.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_sysfs.c +8 -3
index d503f8e8c2d1..43875cb35691 100644
@@ -208,9 +208,12 @@ static ssize_t status_show(struct device *device,
 			   char *buf)
 {
 	struct drm_connector *connector = to_drm_connector(device);
+	enum drm_connector_status status;
+
+	status = READ_ONCE(connector->status);
 
 	return snprintf(buf, PAGE_SIZE, "%s\n",
-			drm_get_connector_status_name(connector->status));
+			drm_get_connector_status_name(status));
 }
 
 static ssize_t dpms_show(struct device *device,
@@ -231,9 +234,11 @@ static ssize_t enabled_show(struct device *device,
 			   char *buf)
 {
 	struct drm_connector *connector = to_drm_connector(device);
+	bool enabled;
+
+	enabled = READ_ONCE(connector->encoder);
 
-	return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
-			"disabled");
+	return snprintf(buf, PAGE_SIZE, enabled ? "enabled\n" : "disabled\n");
 }
 
 static ssize_t edid_show(struct file *filp, struct kobject *kobj,
Signature · 1 line
2.8.0.rc3
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#14 lore raw

PATCH 4/10 drm/sysfs: Nuke TV/DVI property files

In reply to Daniel Vetter

This goes all the way back to the original KMS commit aeons ago

commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef

Author: Dave Airlie <[email protected]>
Date:   Fri Nov 7 14:05:41 2008 -0800

DRM: add mode setting support

But it seems to be completely unused. Only i915 and nouveau even register these properties, and the corresponding DDX don't even look at them. Also the sysfs files are read-only, so not useful to configure anything.

I suspect that this was added with the goal to have read-only access to all properties in sysfs, but we never followed through on that. Also, that should be done in a more generic fashion.

Since it would be real work to fix up the locking (with atomic we're now chasing pointers when reading properties) and it seems unused lets just nuke this all. It's easier. Of course we'll keep the properties themselves, those are still exposed through the KMS ioctls.

---
 drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
 1 file changed, 156 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -156
index 43875cb35691..fa7fadce8063 100644
@@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
 	return written;
 }
 
-static ssize_t tv_subconnector_show(struct device *device,
-				    struct device_attribute *attr,
-				    char *buf)
-{
-	struct drm_connector *connector = to_drm_connector(device);
-	struct drm_device *dev = connector->dev;
-	struct drm_property *prop;
-	uint64_t subconnector;
-	int ret;
-
-	prop = dev->mode_config.tv_subconnector_property;
-	if (!prop) {
-		DRM_ERROR("Unable to find subconnector property\n");
-		return 0;
-	}
-
-	ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-	if (ret)
-		return 0;
-
-	return snprintf(buf, PAGE_SIZE, "%s",
-			drm_get_tv_subconnector_name((int)subconnector));
-}
-
-static ssize_t tv_select_subconnector_show(struct device *device,
-					   struct device_attribute *attr,
-					   char *buf)
-{
-	struct drm_connector *connector = to_drm_connector(device);
-	struct drm_device *dev = connector->dev;
-	struct drm_property *prop;
-	uint64_t subconnector;
-	int ret;
-
-	prop = dev->mode_config.tv_select_subconnector_property;
-	if (!prop) {
-		DRM_ERROR("Unable to find select subconnector property\n");
-		return 0;
-	}
-
-	ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-	if (ret)
-		return 0;
-
-	return snprintf(buf, PAGE_SIZE, "%s",
-			drm_get_tv_select_name((int)subconnector));
-}
-
-static ssize_t dvii_subconnector_show(struct device *device,
-				      struct device_attribute *attr,
-				      char *buf)
-{
-	struct drm_connector *connector = to_drm_connector(device);
-	struct drm_device *dev = connector->dev;
-	struct drm_property *prop;
-	uint64_t subconnector;
-	int ret;
-
-	prop = dev->mode_config.dvi_i_subconnector_property;
-	if (!prop) {
-		DRM_ERROR("Unable to find subconnector property\n");
-		return 0;
-	}
-
-	ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-	if (ret)
-		return 0;
-
-	return snprintf(buf, PAGE_SIZE, "%s",
-			drm_get_dvi_i_subconnector_name((int)subconnector));
-}
-
-static ssize_t dvii_select_subconnector_show(struct device *device,
-					     struct device_attribute *attr,
-					     char *buf)
-{
-	struct drm_connector *connector = to_drm_connector(device);
-	struct drm_device *dev = connector->dev;
-	struct drm_property *prop;
-	uint64_t subconnector;
-	int ret;
-
-	prop = dev->mode_config.dvi_i_select_subconnector_property;
-	if (!prop) {
-		DRM_ERROR("Unable to find select subconnector property\n");
-		return 0;
-	}
-
-	ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-	if (ret)
-		return 0;
-
-	return snprintf(buf, PAGE_SIZE, "%s",
-			drm_get_dvi_i_select_name((int)subconnector));
-}
-
 static DEVICE_ATTR_RW(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
@@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
 	NULL
 };
 
-static DEVICE_ATTR_RO(tv_subconnector);
-static DEVICE_ATTR_RO(tv_select_subconnector);
-
-static struct attribute *connector_tv_dev_attrs[] = {
-	&dev_attr_tv_subconnector.attr,
-	&dev_attr_tv_select_subconnector.attr,
-	NULL
-};
-
-static DEVICE_ATTR_RO(dvii_subconnector);
-static DEVICE_ATTR_RO(dvii_select_subconnector);
-
-static struct attribute *connector_dvii_dev_attrs[] = {
-	&dev_attr_dvii_subconnector.attr,
-	&dev_attr_dvii_select_subconnector.attr,
-	NULL
-};
-
-/* Connector type related helpers */
-static int kobj_connector_type(struct kobject *kobj)
-{
-	struct device *dev = kobj_to_dev(kobj);
-	struct drm_connector *connector = to_drm_connector(dev);
-
-	return connector->connector_type;
-}
-
-static umode_t connector_is_dvii(struct kobject *kobj,
-				 struct attribute *attr, int idx)
-{
-	return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
-		attr->mode : 0;
-}
-
-static umode_t connector_is_tv(struct kobject *kobj,
-			       struct attribute *attr, int idx)
-{
-	switch (kobj_connector_type(kobj)) {
-	case DRM_MODE_CONNECTOR_Composite:
-	case DRM_MODE_CONNECTOR_SVIDEO:
-	case DRM_MODE_CONNECTOR_Component:
-	case DRM_MODE_CONNECTOR_TV:
-		return attr->mode;
-	}
-
-	return 0;
-}
-
 static struct bin_attribute edid_attr = {
 	.attr.name = "edid",
 	.attr.mode = 0444,
@@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
 	.bin_attrs = connector_bin_attrs,
 };
 
-static const struct attribute_group connector_tv_dev_group = {
-	.attrs = connector_tv_dev_attrs,
-	.is_visible = connector_is_tv,
-};
-
-static const struct attribute_group connector_dvii_dev_group = {
-	.attrs = connector_dvii_dev_attrs,
-	.is_visible = connector_is_dvii,
-};
-
 static const struct attribute_group *connector_dev_groups[] = {
 	&connector_dev_group,
-	&connector_tv_dev_group,
-	&connector_dvii_dev_group,
 	NULL
 };
 
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 4/10
#15 lore raw

Re: [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files

Quoted 17 lines · Daniel Vetter

This goes all the way back to the original KMS commit aeons ago

commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef

Author: Dave Airlie <[email protected]>
Date:   Fri Nov 7 14:05:41 2008 -0800

DRM: add mode setting support

But it seems to be completely unused. Only i915 and nouveau even register these properties, and the corresponding DDX don't even look at them. Also the sysfs files are read-only, so not useful to configure anything.

I suspect that this was added with the goal to have read-only access to all properties in sysfs, but we never followed through on that. Also, that should be done in a more generic fashion.

Quoted 6 lines

Since it would be real work to fix up the locking (with atomic we're now chasing pointers when reading properties) and it seems unused lets just nuke this all. It's easier. Of course we'll keep the properties themselves, those are still exposed through the KMS ioctls.

Quoted 190 lines
---
 drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
 1 file changed, 156 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -157
index 43875cb35691..fa7fadce8063 100644
@@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
        return written;
 }
 
-static ssize_t tv_subconnector_show(struct device *device,
-                                   struct device_attribute *attr,
-                                   char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.tv_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_tv_subconnector_name((int)subconnector));
-}
-
-static ssize_t tv_select_subconnector_show(struct device *device,
-                                          struct device_attribute *attr,
-                                          char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.tv_select_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find select subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_tv_select_name((int)subconnector));
-}
-
-static ssize_t dvii_subconnector_show(struct device *device,
-                                     struct device_attribute *attr,
-                                     char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.dvi_i_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_dvi_i_subconnector_name((int)subconnector));
-}
-
-static ssize_t dvii_select_subconnector_show(struct device *device,
-                                            struct device_attribute *attr,
-                                            char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.dvi_i_select_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find select subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_dvi_i_select_name((int)subconnector));
-}
-
 static DEVICE_ATTR_RW(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
@@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
        NULL
 };
 
-static DEVICE_ATTR_RO(tv_subconnector);
-static DEVICE_ATTR_RO(tv_select_subconnector);
-
-static struct attribute *connector_tv_dev_attrs[] = {
-       &dev_attr_tv_subconnector.attr,
-       &dev_attr_tv_select_subconnector.attr,
-       NULL
-};
-
-static DEVICE_ATTR_RO(dvii_subconnector);
-static DEVICE_ATTR_RO(dvii_select_subconnector);
-
-static struct attribute *connector_dvii_dev_attrs[] = {
-       &dev_attr_dvii_subconnector.attr,
-       &dev_attr_dvii_select_subconnector.attr,
-       NULL
-};
-
-/* Connector type related helpers */
-static int kobj_connector_type(struct kobject *kobj)
-{
-       struct device *dev = kobj_to_dev(kobj);
-       struct drm_connector *connector = to_drm_connector(dev);
-
-       return connector->connector_type;
-}
-
-static umode_t connector_is_dvii(struct kobject *kobj,
-                                struct attribute *attr, int idx)
-{
-       return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
-               attr->mode : 0;
-}
-
-static umode_t connector_is_tv(struct kobject *kobj,
-                              struct attribute *attr, int idx)
-{
-       switch (kobj_connector_type(kobj)) {
-       case DRM_MODE_CONNECTOR_Composite:
-       case DRM_MODE_CONNECTOR_SVIDEO:
-       case DRM_MODE_CONNECTOR_Component:
-       case DRM_MODE_CONNECTOR_TV:
-               return attr->mode;
-       }
-
-       return 0;
-}
-
 static struct bin_attribute edid_attr = {
        .attr.name = "edid",
        .attr.mode = 0444,
@@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
        .bin_attrs = connector_bin_attrs,
 };
 
-static const struct attribute_group connector_tv_dev_group = {
-       .attrs = connector_tv_dev_attrs,
-       .is_visible = connector_is_tv,
-};
-
-static const struct attribute_group connector_dvii_dev_group = {
-       .attrs = connector_dvii_dev_attrs,
-       .is_visible = connector_is_dvii,
-};
-
 static const struct attribute_group *connector_dev_groups[] = {
        &connector_dev_group,
-       &connector_tv_dev_group,
-       &connector_dvii_dev_group,
        NULL
 };
 
--

2.8.0.rc3

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

Re: [PATCH 04/10] drm/sysfs: Nuke TV/DVI property files

Quoted 18 lines · Alex Deucher
Quoted 17 lines · Daniel Vetter

This goes all the way back to the original KMS commit aeons ago

commit f453ba0460742ad027ae0c4c7d61e62817b3e7ef

Author: Dave Airlie <[email protected]>
Date:   Fri Nov 7 14:05:41 2008 -0800

DRM: add mode setting support

But it seems to be completely unused. Only i915 and nouveau even register these properties, and the corresponding DDX don't even look at them. Also the sysfs files are read-only, so not useful to configure anything.

I suspect that this was added with the goal to have read-only access to all properties in sysfs, but we never followed through on that. Also, that should be done in a more generic fashion.

Quoted 8 lines
Quoted 6 lines

Since it would be real work to fix up the locking (with atomic we're now chasing pointers when reading properties) and it seems unused lets just nuke this all. It's easier. Of course we'll keep the properties themselves, those are still exposed through the KMS ioctls.

Applied, thanks for the review.
-Daniel

Quoted 195 lines
Quoted 195 lines
---
 drivers/gpu/drm/drm_sysfs.c | 156 --------------------------------------------
 1 file changed, 156 deletions(-)
drivers/gpu/drm/drm_sysfs.c +0 -157
index 43875cb35691..fa7fadce8063 100644
@@ -292,102 +292,6 @@ static ssize_t modes_show(struct device *device,
        return written;
 }
 
-static ssize_t tv_subconnector_show(struct device *device,
-                                   struct device_attribute *attr,
-                                   char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.tv_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_tv_subconnector_name((int)subconnector));
-}
-
-static ssize_t tv_select_subconnector_show(struct device *device,
-                                          struct device_attribute *attr,
-                                          char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.tv_select_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find select subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_tv_select_name((int)subconnector));
-}
-
-static ssize_t dvii_subconnector_show(struct device *device,
-                                     struct device_attribute *attr,
-                                     char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.dvi_i_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_dvi_i_subconnector_name((int)subconnector));
-}
-
-static ssize_t dvii_select_subconnector_show(struct device *device,
-                                            struct device_attribute *attr,
-                                            char *buf)
-{
-       struct drm_connector *connector = to_drm_connector(device);
-       struct drm_device *dev = connector->dev;
-       struct drm_property *prop;
-       uint64_t subconnector;
-       int ret;
-
-       prop = dev->mode_config.dvi_i_select_subconnector_property;
-       if (!prop) {
-               DRM_ERROR("Unable to find select subconnector property\n");
-               return 0;
-       }
-
-       ret = drm_object_property_get_value(&connector->base, prop, &subconnector);
-       if (ret)
-               return 0;
-
-       return snprintf(buf, PAGE_SIZE, "%s",
-                       drm_get_dvi_i_select_name((int)subconnector));
-}
-
 static DEVICE_ATTR_RW(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
@@ -401,54 +305,6 @@ static struct attribute *connector_dev_attrs[] = {
        NULL
 };
 
-static DEVICE_ATTR_RO(tv_subconnector);
-static DEVICE_ATTR_RO(tv_select_subconnector);
-
-static struct attribute *connector_tv_dev_attrs[] = {
-       &dev_attr_tv_subconnector.attr,
-       &dev_attr_tv_select_subconnector.attr,
-       NULL
-};
-
-static DEVICE_ATTR_RO(dvii_subconnector);
-static DEVICE_ATTR_RO(dvii_select_subconnector);
-
-static struct attribute *connector_dvii_dev_attrs[] = {
-       &dev_attr_dvii_subconnector.attr,
-       &dev_attr_dvii_select_subconnector.attr,
-       NULL
-};
-
-/* Connector type related helpers */
-static int kobj_connector_type(struct kobject *kobj)
-{
-       struct device *dev = kobj_to_dev(kobj);
-       struct drm_connector *connector = to_drm_connector(dev);
-
-       return connector->connector_type;
-}
-
-static umode_t connector_is_dvii(struct kobject *kobj,
-                                struct attribute *attr, int idx)
-{
-       return kobj_connector_type(kobj) == DRM_MODE_CONNECTOR_DVII ?
-               attr->mode : 0;
-}
-
-static umode_t connector_is_tv(struct kobject *kobj,
-                              struct attribute *attr, int idx)
-{
-       switch (kobj_connector_type(kobj)) {
-       case DRM_MODE_CONNECTOR_Composite:
-       case DRM_MODE_CONNECTOR_SVIDEO:
-       case DRM_MODE_CONNECTOR_Component:
-       case DRM_MODE_CONNECTOR_TV:
-               return attr->mode;
-       }
-
-       return 0;
-}
-
 static struct bin_attribute edid_attr = {
        .attr.name = "edid",
        .attr.mode = 0444,
@@ -466,20 +322,8 @@ static const struct attribute_group connector_dev_group = {
        .bin_attrs = connector_bin_attrs,
 };
 
-static const struct attribute_group connector_tv_dev_group = {
-       .attrs = connector_tv_dev_attrs,
-       .is_visible = connector_is_tv,
-};
-
-static const struct attribute_group connector_dvii_dev_group = {
-       .attrs = connector_dvii_dev_attrs,
-       .is_visible = connector_is_dvii,
-};
-
 static const struct attribute_group *connector_dev_groups[] = {
        &connector_dev_group,
-       &connector_tv_dev_group,
-       &connector_dvii_dev_group,
        NULL
 };
 
--

2.8.0.rc3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH 5/10 drm: Give drm_agp_clear drm_legacy_ prefix

In reply to Daniel Vetter

It has a DRIVER_MODESET check to sure make it's not creating havoc for drm drivers. Make that clear in the name too.

---
 drivers/gpu/drm/drm_agpsupport.c | 4 ++--
 drivers/gpu/drm/drm_fops.c       | 2 +-
 drivers/gpu/drm/drm_pci.c        | 2 +-
 include/drm/drm_agpsupport.h     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_agpsupport.c +2 -2
index a10ea6aec629..605bd243fb36 100644
@@ -423,7 +423,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 }
 
 /**
- * drm_agp_clear - Clear AGP resource list
+ * drm_legacy_agp_clear - Clear AGP resource list
  * @dev: DRM device
  *
  * Iterate over all AGP resources and remove them. But keep the AGP head
@@ -434,7 +434,7 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev)
  * resources from getting destroyed. Drivers are responsible of cleaning them up
  * during device shutdown.
  */
-void drm_agp_clear(struct drm_device *dev)
+void drm_legacy_agp_clear(struct drm_device *dev)
 {
 	struct drm_agp_mem *entry, *tempe;
 
drivers/gpu/drm/drm_fops.c +1 -1
index aeef58ed359b..7b5a13cda7a6 100644
@@ -413,7 +413,7 @@ int drm_lastclose(struct drm_device * dev)
 
 	mutex_lock(&dev->struct_mutex);
 
-	drm_agp_clear(dev);
+	drm_legacy_agp_clear(dev);
 
 	drm_legacy_sg_cleanup(dev);
 	drm_legacy_vma_flush(dev);
drivers/gpu/drm/drm_pci.c +1 -1
index a1fff1179a97..29d5a548d07a 100644
@@ -250,7 +250,7 @@ void drm_pci_agp_destroy(struct drm_device *dev)
 {
 	if (dev->agp) {
 		arch_phys_wc_del(dev->agp->agp_mtrr);
-		drm_agp_clear(dev);
+		drm_legacy_agp_clear(dev);
 		kfree(dev->agp);
 		dev->agp = NULL;
 	}
include/drm/drm_agpsupport.h +1 -1
index 193ef19dfc5c..e134e9ca422b 100644
@@ -37,7 +37,7 @@ struct agp_memory *drm_agp_bind_pages(struct drm_device *dev,
 				uint32_t type);
 
 struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-void drm_agp_clear(struct drm_device *dev);
+void drm_legacy_agp_clear(struct drm_device *dev);
 int drm_agp_acquire(struct drm_device *dev);
 int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
 			  struct drm_file *file_priv);
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Re: [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix

reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Daniel,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: sparc64-allmodconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64

Note: the linux-review/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803 HEAD 0ef75daff5d81f77ebd5796d853c534749223b2e builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

drivers/gpu/drm/drm_fops.c: In function 'drm_lastclose':

>> drivers/gpu/drm/drm_fops.c:416:2: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
     drm_legacy_agp_clear(dev);
     ^
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/drm_pci.c: In function 'drm_pci_agp_destroy':
>> drivers/gpu/drm/drm_pci.c:253:3: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]
      drm_legacy_agp_clear(dev);
      ^

cc1: some warnings being treated as errors

vim +/drm_legacy_agp_clear +416 drivers/gpu/drm/drm_fops.c

410
411 if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
412 drm_irq_uninstall(dev);
413
414 mutex_lock(&dev->struct_mutex);
415

 > 416		drm_legacy_agp_clear(dev);

417
418 drm_legacy_sg_cleanup(dev);
419 drm_legacy_vma_flush(dev);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

Re: [Intel-gfx] [PATCH 05/10] drm: Give drm_agp_clear drm_legacy_ prefix

Quoted 40 lines · kbuild test robot

Hi Daniel,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.6-rc1 next-20160330]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: sparc64-allmodconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64

Note: the linux-review/Daniel-Vetter/Another-shot-at-cruft-removal/20160330-174803 HEAD 0ef75daff5d81f77ebd5796d853c534749223b2e builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

drivers/gpu/drm/drm_fops.c: In function 'drm_lastclose':

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_fops.c:416:2: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]

     drm_legacy_agp_clear(dev);
     ^

cc1: some warnings being treated as errors
--
drivers/gpu/drm/drm_pci.c: In function 'drm_pci_agp_destroy':

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/drm_pci.c:253:3: error: implicit declaration of function 'drm_legacy_agp_clear' [-Werror=implicit-function-declaration]

      drm_legacy_agp_clear(dev);
      ^

cc1: some warnings being treated as errors

vim +/drm_legacy_agp_clear +416 drivers/gpu/drm/drm_fops.c

   410	
   411		if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
   412			drm_irq_uninstall(dev);
   413	
   414		mutex_lock(&dev->struct_mutex);
   415	
Quoted 4 lines
Quoted 1 line

416 drm_legacy_agp_clear(dev);

417

   418		drm_legacy_sg_cleanup(dev);
   419		drm_legacy_vma_flush(dev);

FWIW, this is because the dummy implementation wasn't renamed.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#20 lore raw

PATCH 6/10 drm: Put legacy lastclose work into drm_legacy_dev_reinit

In reply to Daniel Vetter

Except for the ->lasclose driver callback evrything in drm_lastclose() is all legacy cruft and can be hidden. Which means another dev->struct_mutex site disappears entirely for modern drivers!

Also while at it change the return value of drm_lastclose to void since it will always succeed. No one checks the return value of close() anyway, ever.

---
 drivers/gpu/drm/drm_fops.c     | 42 +++++++++++++++++++-----------------------
 drivers/gpu/drm/drm_internal.h |  2 +-
 include/drm/drm_agpsupport.h   |  2 +-
 3 files changed, 21 insertions(+), 25 deletions(-)
drivers/gpu/drm/drm_fops.c +19 -23
index 7b5a13cda7a6..c3d0aaac0669 100644
@@ -381,14 +381,26 @@ static void drm_events_release(struct drm_file *file_priv)
  */
 static void drm_legacy_dev_reinit(struct drm_device *dev)
 {
-	if (drm_core_check_feature(dev, DRIVER_MODESET))
-		return;
+	if (dev->irq_enabled)
+		drm_irq_uninstall(dev);
+
+	mutex_lock(&dev->struct_mutex);
+
+	drm_legacy_agp_clear(dev);
+
+	drm_legacy_sg_cleanup(dev);
+	drm_legacy_vma_flush(dev);
+	drm_legacy_dma_takedown(dev);
+
+	mutex_unlock(&dev->struct_mutex);
 
 	dev->sigdata.lock = NULL;
 
 	dev->context_flag = 0;
 	dev->last_context = 0;
 	dev->if_version = 0;
+
+	DRM_DEBUG("lastclose completed\n");
 }
 
 /*
@@ -400,7 +412,7 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
  *
  * \sa drm_device
  */
-int drm_lastclose(struct drm_device * dev)
+void drm_lastclose(struct drm_device * dev)
 {
 	DRM_DEBUG("\n");
 
@@ -408,23 +420,8 @@ int drm_lastclose(struct drm_device * dev)
 		dev->driver->lastclose(dev);
 	DRM_DEBUG("driver lastclose completed\n");
 
-	if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
-		drm_irq_uninstall(dev);
-
-	mutex_lock(&dev->struct_mutex);
-
-	drm_legacy_agp_clear(dev);
-
-	drm_legacy_sg_cleanup(dev);
-	drm_legacy_vma_flush(dev);
-	drm_legacy_dma_takedown(dev);
-
-	mutex_unlock(&dev->struct_mutex);
-
-	drm_legacy_dev_reinit(dev);
-
-	DRM_DEBUG("lastclose completed\n");
-	return 0;
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		drm_legacy_dev_reinit(dev);
 }
 
 /**
@@ -445,7 +442,6 @@ int drm_release(struct inode *inode, struct file *filp)
 	struct drm_file *file_priv = filp->private_data;
 	struct drm_minor *minor = file_priv->minor;
 	struct drm_device *dev = minor->dev;
-	int retcode = 0;
 
 	mutex_lock(&drm_global_mutex);
 
@@ -538,7 +534,7 @@ int drm_release(struct inode *inode, struct file *filp)
 	 */
 
 	if (!--dev->open_count) {
-		retcode = drm_lastclose(dev);
+		drm_lastclose(dev);
 		if (drm_device_is_unplugged(dev))
 			drm_put_dev(dev);
 	}
@@ -546,7 +542,7 @@ int drm_release(struct inode *inode, struct file *filp)
 
 	drm_minor_release(minor);
 
-	return retcode;
+	return 0;
 }
 EXPORT_SYMBOL(drm_release);
 
drivers/gpu/drm/drm_internal.h +1 -1
index 43cbda3306ac..c81ff4769e7b 100644
@@ -26,7 +26,7 @@ extern unsigned int drm_timestamp_monotonic;
 
 /* drm_fops.c */
 extern struct mutex drm_global_mutex;
-int drm_lastclose(struct drm_device *dev);
+void drm_lastclose(struct drm_device *dev);
 
 /* drm_pci.c */
 int drm_pci_set_unique(struct drm_device *dev,
include/drm/drm_agpsupport.h +1 -1
index e134e9ca422b..b2d912670a7f 100644
@@ -93,7 +93,7 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 	return NULL;
 }
 
-static inline void drm_agp_clear(struct drm_device *dev)
+static inline void drm_legacy_agp_clear(struct drm_device *dev)
 {
 }
 
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 06/10] drm: Put legacy lastclose work into drm_legacy_dev_reinit

On Wed, Mar 30, 2016 at 11:45:16AM +0200, Daniel Vetter wrote:
[...]

include/drm/drm_agpsupport.h static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev) · line 96

Quoted 10 lines
include/drm/drm_agpsupport.h +1 -1
index e134e9ca422b..b2d912670a7f 100644
@@ -93,7 +93,7 @@ static inline struct drm_agp_head *drm_agp_init(struct drm_device *dev)
 	return NULL;
 }
 
-static inline void drm_agp_clear(struct drm_device *dev)
+static inline void drm_legacy_agp_clear(struct drm_device *dev)

Ah... it ended up in the wrong patch.

Thierry

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

PATCH 7/10 drm: Move drm_getmap into drm_bufs.c and give it a legacy prefix

In reply to Daniel Vetter

It belongs right next to the addmap and rmmap functions really. And for OCD consistency name it drm_legacy_getmap_ioctl.

---
 drivers/gpu/drm/drm_bufs.c   | 52 ++++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c  | 54 +-------------------------------------------
 drivers/gpu/drm/drm_legacy.h |  2 ++
 3 files changed, 55 insertions(+), 53 deletions(-)
drivers/gpu/drm/drm_bufs.c +52 -0
index f1a204d253cc..d92db7007f62 100644
@@ -416,6 +416,58 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
+/*
+ * Get a mapping information.
+ *
+ * \param inode device inode.
+ * \param file_priv DRM file private.
+ * \param cmd command.
+ * \param arg user argument, pointing to a drm_map structure.
+ *
+ * \return zero on success or a negative number on failure.
+ *
+ * Searches for the mapping with the specified offset and copies its information
+ * into userspace
+ */
+int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
+			    struct drm_file *file_priv)
+{
+	struct drm_map *map = data;
+	struct drm_map_list *r_list = NULL;
+	struct list_head *list;
+	int idx;
+	int i;
+
+	idx = map->offset;
+	if (idx < 0)
+		return -EINVAL;
+
+	i = 0;
+	mutex_lock(&dev->struct_mutex);
+	list_for_each(list, &dev->maplist) {
+		if (i == idx) {
+			r_list = list_entry(list, struct drm_map_list, head);
+			break;
+		}
+		i++;
+	}
+	if (!r_list || !r_list->map) {
+		mutex_unlock(&dev->struct_mutex);
+		return -EINVAL;
+	}
+
+	map->offset = r_list->map->offset;
+	map->size = r_list->map->size;
+	map->type = r_list->map->type;
+	map->flags = r_list->map->flags;
+	map->handle = (void *)(unsigned long) r_list->user_token;
+	map->mtrr = arch_phys_wc_index(r_list->map->mtrr);
+
+	mutex_unlock(&dev->struct_mutex);
+
+	return 0;
+}
+
 /**
  * Remove a map private from list and deallocate resources if the mapping
  * isn't in use.
drivers/gpu/drm/drm_ioctl.c +1 -53

66 lines not on this page · raw message

drivers/gpu/drm/drm_legacy.h +2 -0
index 9b731786e4db..d3b6ee357a2b 100644
@@ -63,6 +63,8 @@ int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
 
 #define DRM_MAP_HASH_OFFSET 0x10000000
 
+int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
+			    struct drm_file *file_priv);
 int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f);
 int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f);
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

PATCH 8/10 drm: Forbid legacy MAP functions for DRIVER_MODESET

In reply to Daniel Vetter

Like in

commit 0e975980d435d58df2d430d688b8c18778b42218

Author: Peter Antoine <[email protected]>
Date:   Tue Jun 23 08:18:49 2015 +0100

drm: Turn off Legacy Context Functions

we need to again make an exception for nouveau, but everyone else really doesn't need this.

Cc Peter Antoine <[email protected]>
Cc Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_bufs.c +12 -0
index d92db7007f62..e8a12a4fd400 100644
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
 	if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
 		return -EPERM;
 
+	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+	    drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
 	err = drm_addmap_core(dev, map->offset, map->size, map->type,
 			      map->flags, &maplist);
 
@@ -438,6 +442,10 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
 	int idx;
 	int i;
 
+	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+	    drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
 	idx = map->offset;
 	if (idx < 0)
 		return -EINVAL;
@@ -569,6 +577,10 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
 	struct drm_map_list *r_list;
 	int ret;
 
+	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+	    drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
 	mutex_lock(&dev->struct_mutex);
 	list_for_each_entry(r_list, &dev->maplist, head) {
 		if (r_list->map &&
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET

Quoted 23 lines · Daniel Vetter

Like in

commit 0e975980d435d58df2d430d688b8c18778b42218

Author: Peter Antoine <[email protected]>
Date:   Tue Jun 23 08:18:49 2015 +0100

drm: Turn off Legacy Context Functions

we need to again make an exception for nouveau, but everyone else really doesn't need this.

Cc Peter Antoine <[email protected]>
Cc Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_bufs.c +0 -0
index d92db7007f62..e8a12a4fd400 100644

drivers/gpu/drm/drm_bufs.c int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, · line 402

Quoted 7 lines
drivers/gpu/drm/drm_bufs.c +4 -0
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
        if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
                return -EPERM;
 
+       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+           drm_core_check_feature(dev, DRIVER_MODESET))
+               return -EINVAL;
+

Wondering if making this the first check in the function won't be better ? We have a handful of places which preemptively check DRIVER_MODESET prior to calling drm_legacy functions and similarly some (last time I've looked) drm_legacy functions check for DRIVER_MODESET. Perhaps we can move all the checking into the drm_legacy API alone ?

-Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw

Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET

Quoted 27 lines · Emil Velikov
Quoted 26 lines · Daniel Vetter

Like in

commit 0e975980d435d58df2d430d688b8c18778b42218

Author: Peter Antoine <[email protected]>
Date:   Tue Jun 23 08:18:49 2015 +0100

drm: Turn off Legacy Context Functions

we need to again make an exception for nouveau, but everyone else really doesn't need this.

Cc Peter Antoine <[email protected]>
Cc Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_bufs.c +0 -0
index d92db7007f62..e8a12a4fd400 100644
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
        if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
                return -EPERM;
 
Quoted 10 lines

drivers/gpu/drm/drm_bufs.c int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, · line 402

Quoted 4 lines
drivers/gpu/drm/drm_bufs.c +4 -0
+       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+           drm_core_check_feature(dev, DRIVER_MODESET))
+               return -EINVAL;
+

Wondering if making this the first check in the function won't be better ? We have a handful of places which preemptively check DRIVER_MODESET prior to calling drm_legacy functions and similarly some (last time I've looked) drm_legacy functions check for DRIVER_MODESET. Perhaps we can move all the checking into the drm_legacy API alone ?

This is an ioctl handler, so there's not really any caller we can move this to. In general I'm split, and I just put checks like these wherever it makes sense, pulling them out into callers if there's an entire pile of them who all want the same checks.

In the end I don't think it matters, as long as we dutifully combine drm_legacy_* with such checks, so that it's _really_ all dead code for modern drives.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#26 lore raw

Re: [PATCH 08/10] drm: Forbid legacy MAP functions for DRIVER_MODESET

Quoted 39 lines · Daniel Vetter
Quoted 27 lines · Emil Velikov
Quoted 26 lines · Daniel Vetter

Like in

commit 0e975980d435d58df2d430d688b8c18778b42218

Author: Peter Antoine <[email protected]>
Date:   Tue Jun 23 08:18:49 2015 +0100

drm: Turn off Legacy Context Functions

we need to again make an exception for nouveau, but everyone else really doesn't need this.

Cc Peter Antoine <[email protected]>
Cc Ben Skeggs <[email protected]>
---
 drivers/gpu/drm/drm_bufs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/gpu/drm/drm_bufs.c +0 -0
index d92db7007f62..e8a12a4fd400 100644
@@ -396,6 +396,10 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
        if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
                return -EPERM;
 
Quoted 10 lines

drivers/gpu/drm/drm_bufs.c int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data, · line 402

Quoted 4 lines
drivers/gpu/drm/drm_bufs.c +4 -0
+       if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+           drm_core_check_feature(dev, DRIVER_MODESET))
+               return -EINVAL;
+

Wondering if making this the first check in the function won't be better ? We have a handful of places which preemptively check DRIVER_MODESET prior to calling drm_legacy functions and similarly some (last time I've looked) drm_legacy functions check for DRIVER_MODESET. Perhaps we can move all the checking into the drm_legacy API alone ?

Quoted 2 lines

This is an ioctl handler, so there's not really any caller we can move this to.

Indeed. One could extract the legacy ioctls into separate table and/or use a function alike drm_ioctl_permit() to generalise things. It will allow clear and obvious separation of things, although the particular above will make things a bit annoying.

Quoted 7 lines

In general I'm split, and I just put checks like these wherever it makes sense, pulling them out into callers if there's an entire pile of them who all want the same checks.

In the end I don't think it matters, as long as we dutifully combine drm_legacy_* with such checks, so that it's _really_ all dead code for modern drives.

I'd suspect that there's a few bits that are missing the check, plus going through might be a bit time consuming. Thus thinking of a 'generic' way to handle things.

Just thinking out loud :-)

-Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

PATCH 9/10 drm: Push struct_mutex into ->master_destroy

In reply to Daniel Vetter

Only two drivers implement this hook. vmwgfx (which doesn't need it really) and legacy radeon (which since v1 has been nuked, yay).

v1: Rebase over radeon ums removal.

Cc Thomas Hellstrom <[email protected]>
Cc Alex Deucher <[email protected]>
---
 drivers/gpu/drm/drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +1 -1
index 167c8d3d4a31..845aa644c890 100644
@@ -113,10 +113,10 @@ static void drm_master_destroy(struct kref *kref)
 	struct drm_device *dev = master->minor->dev;
 	struct drm_map_list *r_list, *list_temp;
 
-	mutex_lock(&dev->struct_mutex);
 	if (dev->driver->master_destroy)
 		dev->driver->master_destroy(dev, master);
 
+	mutex_lock(&dev->struct_mutex);
 	list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
 		if (r_list->master == master) {
 			drm_legacy_rmmap_locked(dev, r_list->map);
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#28 lore raw

PATCH 10/10 drm: Hide master MAP cleanup in drm_bufs.c

In reply to Daniel Vetter

And again make sure it's a no-op for modern drivers, again with the exception of nouveau. Another case of dev->struct_mutex gone for modern drivers!

v2: Also add a DRIVER_* check like for all other maps functions to really short-circuit the code. And give drm_legacy_rmmap used by the dev unregister code the same treatment.

---
 drivers/gpu/drm/drm_bufs.c | 28 ++++++++++++++++++++++++----
 drivers/gpu/drm/drm_drv.c  | 10 +---------
 include/drm/drm_legacy.h   |  4 +++-
 3 files changed, 28 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_bufs.c +24 -4
index e8a12a4fd400..5a51633da033 100644
@@ -542,18 +542,38 @@ int drm_legacy_rmmap_locked(struct drm_device *dev, struct drm_local_map *map)
 }
 EXPORT_SYMBOL(drm_legacy_rmmap_locked);
 
-int drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
+void drm_legacy_rmmap(struct drm_device *dev, struct drm_local_map *map)
 {
-	int ret;
+	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+	    drm_core_check_feature(dev, DRIVER_MODESET))
+		return;
 
 	mutex_lock(&dev->struct_mutex);
-	ret = drm_legacy_rmmap_locked(dev, map);
+	drm_legacy_rmmap_locked(dev, map);
 	mutex_unlock(&dev->struct_mutex);
 
-	return ret;
+	return;
 }
 EXPORT_SYMBOL(drm_legacy_rmmap);
 
+void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master)
+{
+	struct drm_map_list *r_list, *list_temp;
+
+	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
+	    drm_core_check_feature(dev, DRIVER_MODESET))
+		return;
+
+	mutex_lock(&dev->struct_mutex);
+	list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
+		if (r_list->master == master) {
+			drm_legacy_rmmap_locked(dev, r_list->map);
+			r_list = NULL;
+		}
+	}
+	mutex_unlock(&dev->struct_mutex);
+}
+
 /* The rmmap ioctl appears to be unnecessary.  All mappings are torn down on
  * the last close of the device, and this is necessary for cleanup when things
  * exit uncleanly.  Therefore, having userland manually remove mappings seems
drivers/gpu/drm/drm_drv.c +1 -9
index 845aa644c890..4bd8ec529060 100644
@@ -111,19 +111,11 @@ static void drm_master_destroy(struct kref *kref)
 {
 	struct drm_master *master = container_of(kref, struct drm_master, refcount);
 	struct drm_device *dev = master->minor->dev;
-	struct drm_map_list *r_list, *list_temp;
 
 	if (dev->driver->master_destroy)
 		dev->driver->master_destroy(dev, master);
 
-	mutex_lock(&dev->struct_mutex);
-	list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) {
-		if (r_list->master == master) {
-			drm_legacy_rmmap_locked(dev, r_list->map);
-			r_list = NULL;
-		}
-	}
-	mutex_unlock(&dev->struct_mutex);
+	drm_legacy_master_rmmaps(dev, master);
 
 	idr_destroy(&master->magic_map);
 	kfree(master->unique);
include/drm/drm_legacy.h +3 -1
index 3e698038dc7b..a5ef2c7e40f8 100644
@@ -154,8 +154,10 @@ struct drm_map_list {
 int drm_legacy_addmap(struct drm_device *d, resource_size_t offset,
 		      unsigned int size, enum drm_map_type type,
 		      enum drm_map_flags flags, struct drm_local_map **map_p);
-int drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
+void drm_legacy_rmmap(struct drm_device *d, struct drm_local_map *map);
 int drm_legacy_rmmap_locked(struct drm_device *d, struct drm_local_map *map);
+void drm_legacy_master_rmmaps(struct drm_device *dev,
+			      struct drm_master *master);
 struct drm_local_map *drm_legacy_getsarea(struct drm_device *dev);
 int drm_legacy_mmap(struct file *filp, struct vm_area_struct *vma);
 
Signature · 6 lines
2.8.0.rc3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

✗ Fi.CI.BAT: failure for Another shot at cruft removal

In reply to Daniel Vetter
== Series Details ==

== Series Details ==

Series: Another shot at cruft removal
URL : https://patchwork.freedesktop.org/series/5033/
State : failure

== Summary ==

Series 5033v1 Another shot at cruft removal

2016-03-30T09:23:14.874392 http://patchwork.freedesktop.org/api/1.0/series/5033/revisions/1/mbox/

Applying: drm/ttm: Remove TTM_HAS_AGP
Using index info to reconstruct a base tree...
M drivers/gpu/drm/ttm/Makefile
M drivers/gpu/drm/ttm/ttm_agp_backend.c
M drivers/gpu/drm/ttm/ttm_page_alloc.c
M drivers/gpu/drm/ttm/ttm_page_alloc_dma.c
M include/drm/ttm/ttm_bo_driver.h
Falling back to patching base and 3-way merge... Auto-merging include/drm/ttm/ttm_bo_driver.h
CONFLICT (content): Merge conflict in include/drm/ttm/ttm_bo_driver.h Patch failed at 0001 drm/ttm: Remove TTM_HAS_AGP

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx