Skip to contentSkip to conversation

drm/komeda: Convert to DEFINE_SHOW_ATTRIBUTE

PATCH Superseded Qinglang Miao 3 participants 7 messages Jul 16, 2020 – Sep 17, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/komeda: Convert to DEFINE_SHOW_ATTRIBUTE

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -12
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
 	return 0;
 }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, komeda_register_show, inode->i_private);
-}
-
-static const struct file_operations komeda_register_fops = {
-	.owner		= THIS_MODULE,
-	.open		= komeda_register_open,
-	.read_iter		= seq_read_iter,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 
 #ifdef CONFIG_DEBUG_FS
 static void komeda_debugfs_init(struct komeda_dev *mdev)
Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -4
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
 	return 0;
 }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-	return single_open(filp, komeda_register_show, inode->i_private);
-}

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -8
-
-static const struct file_operations komeda_register_fops = {
-	.owner		= THIS_MODULE,
-	.open		= komeda_register_open,
-	.read_iter		= seq_read_iter,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Thanks for your patch.

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

Thanks
James

Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -0
 #ifdef CONFIG_DEBUG_FS
 static void komeda_debugfs_init(struct komeda_dev *mdev)
Signature · 1 line
2.17.1
#2 lore raw
Quoted 36 lines · james qian wang (Arm Technology China)
Quoted 21 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -4
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
      return 0;
 }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-     return single_open(filp, komeda_register_show, inode->i_private);
-}

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -8
-
-static const struct file_operations komeda_register_fops = {
-     .owner          = THIS_MODULE,
-     .open           = komeda_register_open,
-     .read_iter              = seq_read_iter,
-     .llseek         = seq_lseek,
-     .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Quoted 6 lines

Thanks for your patch.

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

I do think it's for drm-misc-next, what other tree would it be for? Some people put -next in their patch tag to differentiate from -fixes, so maintainers know what to do with the patch. It's also not part of a series, hence I think this is on you to apply it.

Cheers, Daniel

Quoted 12 lines

Thanks
James

Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -1
 #ifdef CONFIG_DEBUG_FS
 static void komeda_debugfs_init(struct komeda_dev *mdev)
--

2.17.1

_______________________________________________
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
#3 lore raw
Quoted 21 lines · Daniel Vetter
Quoted 19 lines · james qian wang (Arm Technology China)
Quoted 17 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
 drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -0
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
      return 0;
 }
 
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 52

Quoted 9 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -9
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-     return single_open(filp, komeda_register_show, inode->i_private);
-}
-
-static const struct file_operations komeda_register_fops = {
-     .owner          = THIS_MODULE,
-     .open           = komeda_register_open,
-     .read_iter              = seq_read_iter,

- .read = seq_read,
+ .read_iter = seq_read_iter,

Quoted 15 lines
Quoted 8 lines

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 5 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -3
-     .llseek         = seq_lseek,
-     .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Quoted 6 lines

Thanks for your patch.

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

Quoted 6 lines

I do think it's for drm-misc-next, what other tree would it be for? Some people put -next in their patch tag to differentiate from -fixes, so maintainers know what to do with the patch. It's also not part of a series, hence I think this is on you to apply it.

Cheers, Daniel

Hi Daniel:

I tried to apply this patch to drm-misc-next, but failed, and found this patch is actually based on linux-next, and the code base of linux-next is a little different with our drm-misc-next. and one of the difference is linux-next has a patch (call it patch-A):

seq_file: switch over direct seq_read method calls to seq_read_iter
https://lkml.org/lkml/2020/7/7/1267

which changed code like below:

drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -1
index 1d767473ba8a06..0246b2e94d8cbd 100644
@@ -49,7 +49,7 @@ static int komeda_register_open(struct inode *inode, struct file *filp)
 static const struct file_operations komeda_register_fops = {
 	.owner		= THIS_MODULE,
 	.open		= komeda_register_open,
-	.read		= seq_read,
+	.read_iter		= seq_read_iter,
 	.llseek		= seq_lseek,
 	.release	= single_release,
 };

And these code will be deleted by this patch, if we merge this patch into drm-misc-next firstly before the patch-A, that may import a conflict when we merge our misc into upstreams.

if we want it to be merged into drm-misc, I think we'd better to wait the upstream (the patch-A) has been synced back to drm-misc.

And what's your opinion ?

Thanks
James

Quoted 4 lines
Quoted 4 lines

Thanks
James

Quoted 15 lines
Quoted 8 lines
Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -1
 #ifdef CONFIG_DEBUG_FS
 static void komeda_debugfs_init(struct komeda_dev *mdev)
--

2.17.1

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

Signature · 3 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

#4 lore raw
In reply to Daniel Vetter
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · james qian wang (Arm Technology China)
Quoted 21 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
  drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
  1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -4
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
       return 0;
  }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-     return single_open(filp, komeda_register_show, inode->i_private);
-}

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -8
-
-static const struct file_operations komeda_register_fops = {
-     .owner          = THIS_MODULE,
-     .open           = komeda_register_open,
-     .read_iter              = seq_read_iter,
-     .llseek         = seq_lseek,
-     .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Thanks for your patch.

Quoted 8 lines
Quoted 2 lines

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

I do think it's for drm-misc-next, what other tree would it be for? Some people put -next in their patch tag to differentiate from -fixes, so maintainers know what to do with the patch. It's also not part of a series, hence I think this is on you to apply it.

Hi James & Daniel,

​Sorry I didn't make it clear in commit log, but it do based on linux-next.

​I think the reason why James think it's not for drm-misc-next
is conflicts exists when this patch being applied. There's conflicts because commit <4d4901c6d7> which switched over direct seq_read method calls to seq_read_iter should applied before this clean-up patch(linkage listed as below).

https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/+/4d4901c6d748efab8aab6e7d2405dadaed0bea50

I can send a new patch based on mainline if needed.

​Thanks.

Qinglang

.

Quoted 18 lines

Cheers, Daniel

Quoted 12 lines

Thanks
James

Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -1
  #ifdef CONFIG_DEBUG_FS
  static void komeda_debugfs_init(struct komeda_dev *mdev)
--

2.17.1

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

#5 lore raw
Quoted 63 lines · miaoqinglang
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · james qian wang (Arm Technology China)
Quoted 21 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
  drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
  1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -4
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
       return 0;
  }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-     return single_open(filp, komeda_register_show, inode->i_private);
-}

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -8
-
-static const struct file_operations komeda_register_fops = {
-     .owner          = THIS_MODULE,
-     .open           = komeda_register_open,
-     .read_iter              = seq_read_iter,
-     .llseek         = seq_lseek,
-     .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Thanks for your patch.

Quoted 8 lines
Quoted 2 lines

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

I do think it's for drm-misc-next, what other tree would it be for? Some people put -next in their patch tag to differentiate from -fixes, so maintainers know what to do with the patch. It's also not part of a series, hence I think this is on you to apply it.

Hi James & Daniel,

​Sorry I didn't make it clear in commit log, but it do based on linux-next.

​I think the reason why James think it's not for drm-misc-next is conflicts exists when this patch being applied. There's conflicts because commit <4d4901c6d7> which switched over direct seq_read method calls to seq_read_iter should applied before this clean-up patch(linkage listed as below).

Quoted 3 lines

https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/+/4d4901c6d748efab8aab6e7d2405dadaed0bea50

I can send a new patch based on mainline if needed.

Uh yes this is annoying. We're at feature cutoff so this will likely cause bad conflicts no matter what if we merge it now, but the clean solution is to rebase onto drm-misc-next, and then let maintainers sort out the mess with conflicts. It's a pretty simple change in the above patch, so shouldn't cause too many troubles.
-Daniel

Quoted 26 lines

​Thanks.

Qinglang

.

Quoted 18 lines

Cheers, Daniel

Quoted 12 lines

Thanks
James

Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -1
  #ifdef CONFIG_DEBUG_FS
  static void komeda_debugfs_init(struct komeda_dev *mdev)
--

2.17.1

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

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#6 lore raw
Quoted 66 lines · Daniel Vetter
Quoted 65 lines · miaoqinglang
Quoted 42 lines · Daniel Vetter
Quoted 40 lines · james qian wang (Arm Technology China)
Quoted 21 lines · Qinglang Miao

From: Liu Shixin <[email protected]>

Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

---
   drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 13 +------------
   1 file changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -4
index 0246b2e94..4a10e6b9e 100644
@@ -41,18 +41,7 @@ static int komeda_register_show(struct seq_file *sf, void *x)
        return 0;
   }
 
-static int komeda_register_open(struct inode *inode, struct file *filp)
-{
-     return single_open(filp, komeda_register_show, inode->i_private);
-}

drivers/gpu/drm/arm/display/komeda/komeda_dev.c static int komeda_register_show(struct seq_file *sf, void *x) · line 45

Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +1 -8
-
-static const struct file_operations komeda_register_fops = {
-     .owner          = THIS_MODULE,
-     .open           = komeda_register_open,
-     .read_iter              = seq_read_iter,
-     .llseek         = seq_lseek,
-     .release        = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(komeda_register);
 

Hi Shixin & Qinglang

Thanks for your patch.

Quoted 8 lines
Quoted 2 lines

Since your patch is not for drm-misc-next, so seems better to leave it to you to merge it. :)

I do think it's for drm-misc-next, what other tree would it be for? Some people put -next in their patch tag to differentiate from -fixes, so maintainers know what to do with the patch. It's also not part of a series, hence I think this is on you to apply it.

Hi James & Daniel,

​Sorry I didn't make it clear in commit log, but it do based on linux-next.

​I think the reason why James think it's not for drm-misc-next is conflicts exists when this patch being applied. There's conflicts because commit <4d4901c6d7> which switched over direct seq_read method calls to seq_read_iter should applied before this clean-up patch(linkage listed as below).

https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next/+/4d4901c6d748efab8aab6e7d2405dadaed0bea50

Quoted 9 lines
Quoted 1 line

I can send a new patch based on mainline if needed.

Uh yes this is annoying. We're at feature cutoff so this will likely cause bad conflicts no matter what if we merge it now, but the clean solution is to rebase onto drm-misc-next, and then let maintainers sort out the mess with conflicts. It's a pretty simple change in the above patch, so shouldn't cause too many troubles.
-Daniel

Hi James & Daniel,

I've sent v2 patch based on based on linux-next(20200917), and can be applied to mainline cleanly now.

Thanks.

Quoted 28 lines
Quoted 27 lines

​Thanks.

Qinglang

.

Quoted 18 lines

Cheers, Daniel

Quoted 12 lines

Thanks
James

Quoted 4 lines
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +0 -1
   #ifdef CONFIG_DEBUG_FS
   static void komeda_debugfs_init(struct komeda_dev *mdev)
--

2.17.1

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