Skip to contentSkip to conversation

misc patches

PATCH In review Rolf Eike Beer 3 participants 10 messages Jul 9, 2007 – Jul 10, 2007

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

cover misc patches

This are some random patches I've lying around here. They are not related to each other

1) Use kcalloc() in drivers/video/aty/atyfb_base.c
2) Initialize filp->private_data only once in em28xx_v4l2_open
3) [Doc] Fix typos in fs/sysfs/file.c
4) [Doc] Document pci_iomap()

Eike

#1 lore raw

PATCH 1/4 Use kcalloc() in drivers/video/aty/atyfb_base.c

---
commit cc4a7b5dfee25083a6a5741b5b640ae2a1d3aa12
tree a4763216a61fa1501bf9b5dbb60f8860d1620b99
parent dcd9673a1ca36cb084de58f443edf42fd64b186b
author Rolf Eike Beer <[email protected]> Mon, 07 Aug 2006 13:36:24 +0200 committer Rolf Eike Beer <[email protected]> Mon, 07 Aug 2006 13:36:24 +0200

 drivers/video/aty/atyfb_base.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/video/aty/atyfb_base.c +1 -2
index 053ff63..6bc51bb 100644
@@ -2995,12 +2995,11 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
 		/* nothing */ ;
 	j = i + 4;
 
-	par->mmap_map = kmalloc(j * sizeof(*par->mmap_map), GFP_ATOMIC);
+	par->mmap_map = kcalloc(j, sizeof(*par->mmap_map), GFP_ATOMIC);
 	if (!par->mmap_map) {
 		PRINTKE("atyfb_setup_sparc() can't alloc mmap_map\n");
 		return -ENOMEM;
 	}
-	memset(par->mmap_map, 0, j * sizeof(*par->mmap_map));
 
 	for (i = 0, j = 2; i < 6 && pdev->resource[i].start; i++) {
 		struct resource *rp = &pdev->resource[i];
#2 lore raw

PATCH 2/4 Initialize filp->private_data only once in em28xx_v4l2_open

In reply to Rolf Eike Beer

Some lines later filp->private_data is initialized to dev again. Since there are some checks that might fail in the mean time keep the later version.

---
commit 7103e0b114b01a16d7c1ea71914d5069d974167d
tree 6b976d7ce4e872b32805d7df73dd13b5349d439f
parent 39c068bce1d63f6c1345c1ddfda1841d9fd20c74
author Rolf Eike Beer <[email protected]> Tue, 25 Jul 2006 17:55:34 +0200 committer Rolf Eike Beer <[email protected]> Tue, 25 Jul 2006 17:55:34 +0200

 drivers/media/video/em28xx/em28xx-video.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/media/video/em28xx/em28xx-video.c +0 -2
index 2a461dd..b2ae0c8 100644
@@ -268,8 +268,6 @@ static int em28xx_v4l2_open(struct inode *inode, struct file *filp)
 	if (NULL == dev)
 		return -ENODEV;
 
-	filp->private_data=dev;
-
 	em28xx_videodbg("open minor=%d type=%s users=%d\n",
 				minor,v4l2_type_names[dev->type],dev->users);
 
#3 lore raw

PATCH 3/4 Fix typos in fs/sysfs/file.c

In reply to Rolf Eike Beer

---
commit 966fef8404d59056d8524bf94d7dff790fe1fa82
tree 1adc274bc9b8e7e420db0b0023c8b70bd294e84e
parent 0cbdc367b144a95709852c642a069ed652989520
author Rolf Eike Beer <[email protected]> Mon, 21 May 2007 22:55:30 +0200 committer Rolf Eike Beer <[email protected]> Mon, 21 May 2007 22:55:30 +0200

 fs/sysfs/file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/sysfs/file.c +1 -1
index b502c71..dcb8e83 100644
@@ -370,7 +370,7 @@ static int sysfs_release(struct inode * inode, struct file * filp)
  * again will not get new data, or reset the state of 'poll'.
  * Reminder: this only works for attributes which actively support
  * it, and it is not possible to test an attribute from userspace
- * to see if it supports poll (Nether 'poll' or 'select' return
+ * to see if it supports poll (Neither 'poll' nor 'select' return
  * an appropriate error code).  When in doubt, set a suitable timeout value.
  */
 static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
#4 lore raw

PATCH 4/4 Document pci_iomap()

In reply to Rolf Eike Beer

This useful interface is hardly mentioned anywhere in the in-tree documentation.

---
commit 2cb2450818804edcbcb1486a4df0db06e5d49969
tree 2c53fbd2e0be832767446a8684561200b437a695
parent 288a3f1fd00365669ed9ad725b15ff67004cee0a
author Rolf Eike Beer <[email protected]> Mon, 14 Aug 2006 14:20:30 +0200 committer Rolf Eike Beer <[email protected]> Mon, 14 Aug 2006 14:20:30 +0200

 Documentation/DocBook/deviceiobook.tmpl |    1 +
 include/asm-i386/io.h                   |    3 +++
 lib/iomap.c                             |   15 ++++++++++++++-
 3 files changed, 18 insertions(+), 1 deletions(-)
Documentation/DocBook/deviceiobook.tmpl +1 -0
index 90ed23d..4f85515 100644
@@ -317,6 +317,7 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
   <chapter id="pubfunctions">
      <title>Public Functions Provided</title>
 !Einclude/asm-i386/io.h
+!Elib/iomap.c
   </chapter>
 
 </book>
include/asm-i386/io.h +3 -0
index b3724fe..e176483 100644
@@ -112,6 +112,9 @@ extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign
  * writew/writel functions and the other mmio helpers. The returned
  * address is not guaranteed to be usable directly as a virtual
  * address. 
+ *
+ * If the area you are trying to map is a PCI BAR you should have a
+ * look on pci_iomap().
  */
 
 static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
lib/iomap.c +14 -1
index 55689c5..8de891d 100644
@@ -202,7 +202,20 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
-/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+/**
+ * pci_iomap - create a virtual mapping cookie for a PCI BAR
+ * @dev: PCI device that owns the BAR
+ * @bar: BAR number
+ * @maxlen: length of the memory to map
+ *
+ * Using this function you will get a __iomem address to your device BAR.
+ * You can access it using ioread*() and iowrite*(). These functions hide 
+ * the details if this is a MMIO or PIO address space and will just do what 
+ * you expect from them in the correct way.
+ *
+ * @maxlen specifies the maximum length to map. If you want to get access to 
+ * the complete BAR without checking for their length first pass %0 here.
+ **/
 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
 	unsigned long start = pci_resource_start(dev, bar);
#5 lore raw

Re: [PATCH 4/4][Doc] Document pci_iomap()

Quoted 4 lines · On Sun, 8 Jul 2007 18:09:19 +0200 Rolf Eike Beer wrote:

This useful interface is hardly mentioned anywhere in the in-tree documentation.

Hi Rolf,

quilt says:

Warning: trailing whitespace in lines 250,251,254 of lib/iomap.c

Quoted 17 lines

---
commit 2cb2450818804edcbcb1486a4df0db06e5d49969
tree 2c53fbd2e0be832767446a8684561200b437a695
parent 288a3f1fd00365669ed9ad725b15ff67004cee0a
author Rolf Eike Beer <[email protected]> Mon, 14 Aug 2006 14:20:30 +0200 committer Rolf Eike Beer <[email protected]> Mon, 14 Aug 2006 14:20:30 +0200

 Documentation/DocBook/deviceiobook.tmpl |    1 +
 include/asm-i386/io.h                   |    3 +++
 lib/iomap.c                             |   15 ++++++++++++++-
 3 files changed, 18 insertions(+), 1 deletions(-)
Documentation/DocBook/deviceiobook.tmpl +0 -0
index 90ed23d..4f85515 100644

Documentation/DocBook/deviceiobook.tmpl CPU B: spin_unlock_irqrestore(&amp;dev_lock, flags) · line 319

Quoted 3 lines
Documentation/DocBook/deviceiobook.tmpl +0 -0
@@ -317,6 +317,7 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
   <chapter id="pubfunctions">
      <title>Public Functions Provided</title>
 !Einclude/asm-i386/io.h

Weird. After applying this patch, I am getting this kdoc warning:

DOCPROC Documentation/DocBook/deviceiobook.xml
Warning(/var/linsrc/linux-2.6.22//include/asm-i386/io.h): no structured comments found

but the warning is not correct... :(
Oh, the !E should be !I for the io.h file.
Would you correct that also? :)

Quoted 9 lines
Documentation/DocBook/deviceiobook.tmpl +1 -0
+!Elib/iomap.c
   </chapter>
 
 </book>
include/asm-i386/io.h +0 -0
index b3724fe..e176483 100644

include/asm-i386/io.h extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign · line 117

Quoted 6 lines
include/asm-i386/io.h +3 -0
@@ -112,6 +112,9 @@ extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign
  * writew/writel functions and the other mmio helpers. The returned
  * address is not guaranteed to be usable directly as a virtual
  * address. 
+ *
+ * If the area you are trying to map is a PCI BAR you should have a
+ * look on pci_iomap().

look at

Quoted 15 lines
include/asm-i386/io.h +0 -0
  */
 
 static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
lib/iomap.c +3 -1
index 55689c5..8de891d 100644
@@ -202,7 +202,20 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
-/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+/**
+ * pci_iomap - create a virtual mapping cookie for a PCI BAR
+ * @dev: PCI device that owns the BAR

lib/iomap.c void ioport_unmap(void __iomem *addr) · line 217

Quoted 10 lines
lib/iomap.c +10 -0
+ * @bar: BAR number
+ * @maxlen: length of the memory to map
+ *
+ * Using this function you will get a __iomem address to your device BAR.
+ * You can access it using ioread*() and iowrite*(). These functions hide 
+ * the details if this is a MMIO or PIO address space and will just do what 
+ * you expect from them in the correct way.
+ *
+ * @maxlen specifies the maximum length to map. If you want to get access to 
+ * the complete BAR without checking for their length first pass %0 here.

s/their/its/
s/first/first,/

lib/iomap.c void ioport_unmap(void __iomem *addr) · line 221

Quoted 5 lines
lib/iomap.c +1 -0
+ **/
 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
 	unsigned long start = pci_resource_start(dev, bar);

Please make these minor corrections. Looks good to me. Matthew, OK with you?

Thanks.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#6 lore raw

PATCH 1/1 Document pci_iomap()

This useful interface is hardly mentioned anywhere in the in-tree documentation.

---
commit bdf4a23b9b1ff4be79a6f9b863f7203dba2dc808
tree a53c4a6c90e13d55fbf2a0b40cd9676bd9a5d0e5
parent 33738cbb6555861de1dce626c913fad06ce658cc
author Rolf Eike Beer <[email protected]> Tue, 10 Jul 2007 11:08:51 +0200 committer Rolf Eike Beer <[email protected]> Tue, 10 Jul 2007 11:08:51 +0200

 Documentation/DocBook/deviceiobook.tmpl |    3 ++-
 include/asm-i386/io.h                   |    3 +++
 lib/iomap.c                             |   15 ++++++++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)
Documentation/DocBook/deviceiobook.tmpl +2 -1
index 90ed23d..c917de6 100644
@@ -316,7 +316,8 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
 
   <chapter id="pubfunctions">
      <title>Public Functions Provided</title>
-!Einclude/asm-i386/io.h
+!Iinclude/asm-i386/io.h
+!Elib/iomap.c
   </chapter>
 
 </book>
include/asm-i386/io.h +3 -0
index e797586..c48ef18 100644
@@ -112,6 +112,9 @@ extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign
  * writew/writel functions and the other mmio helpers. The returned
  * address is not guaranteed to be usable directly as a virtual
  * address. 
+ *
+ * If the area you are trying to map is a PCI BAR you should have a
+ * look at pci_iomap().
  */
 
 static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
lib/iomap.c +14 -1
index a57d262..864f2ec 100644
@@ -240,7 +240,20 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
-/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+/**
+ * pci_iomap - create a virtual mapping cookie for a PCI BAR
+ * @dev: PCI device that owns the BAR
+ * @bar: BAR number
+ * @maxlen: length of the memory to map
+ *
+ * Using this function you will get a __iomem address to your device BAR.
+ * You can access it using ioread*() and iowrite*(). These functions hide
+ * the details if this is a MMIO or PIO address space and will just do what
+ * you expect from them in the correct way.
+ *
+ * @maxlen specifies the maximum length to map. If you want to get access to
+ * the complete BAR without checking for its length first, pass %0 here.
+ * */
 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
 	unsigned long start = pci_resource_start(dev, bar);
Acked-by on v1 1/1
#7 lore raw

Re: [PATCH][Doc] Document pci_iomap()

Quoted 4 lines · On Tue, 10 Jul 2007 11:11:28 +0200 Rolf Eike Beer wrote:

This useful interface is hardly mentioned anywhere in the in-tree documentation.

Quoted 57 lines

---
commit bdf4a23b9b1ff4be79a6f9b863f7203dba2dc808
tree a53c4a6c90e13d55fbf2a0b40cd9676bd9a5d0e5
parent 33738cbb6555861de1dce626c913fad06ce658cc
author Rolf Eike Beer <[email protected]> Tue, 10 Jul 2007 11:08:51 +0200 committer Rolf Eike Beer <[email protected]> Tue, 10 Jul 2007 11:08:51 +0200

 Documentation/DocBook/deviceiobook.tmpl |    3 ++-
 include/asm-i386/io.h                   |    3 +++
 lib/iomap.c                             |   15 ++++++++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)
Documentation/DocBook/deviceiobook.tmpl +2 -1
index 90ed23d..c917de6 100644
@@ -316,7 +316,8 @@ CPU B:  spin_unlock_irqrestore(&amp;dev_lock, flags)
 
   <chapter id="pubfunctions">
      <title>Public Functions Provided</title>
-!Einclude/asm-i386/io.h
+!Iinclude/asm-i386/io.h
+!Elib/iomap.c
   </chapter>
 
 </book>
include/asm-i386/io.h +3 -0
index e797586..c48ef18 100644
@@ -112,6 +112,9 @@ extern void __iomem * __ioremap(unsigned long offset, unsigned long size, unsign
  * writew/writel functions and the other mmio helpers. The returned
  * address is not guaranteed to be usable directly as a virtual
  * address. 
+ *
+ * If the area you are trying to map is a PCI BAR you should have a
+ * look at pci_iomap().
  */
 
 static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
lib/iomap.c +8 -1
index a57d262..864f2ec 100644
@@ -240,7 +240,20 @@ void ioport_unmap(void __iomem *addr)
 EXPORT_SYMBOL(ioport_map);
 EXPORT_SYMBOL(ioport_unmap);
 
-/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
+/**
+ * pci_iomap - create a virtual mapping cookie for a PCI BAR
+ * @dev: PCI device that owns the BAR
+ * @bar: BAR number
+ * @maxlen: length of the memory to map
+ *
+ * Using this function you will get a __iomem address to your device BAR.
+ * You can access it using ioread*() and iowrite*(). These functions hide

lib/iomap.c void ioport_unmap(void __iomem *addr)

Quoted 10 lines
lib/iomap.c +6 -1
+ * the details if this is a MMIO or PIO address space and will just do what
+ * you expect from them in the correct way.
+ *
+ * @maxlen specifies the maximum length to map. If you want to get access to
+ * the complete BAR without checking for its length first, pass %0 here.
+ * */
 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
 {
 	unsigned long start = pci_resource_start(dev, bar);
-

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#8 lore raw
In reply to Rolf Eike Beer
Quoted 7 lines · On Sun, 8 Jul 2007 17:53:56 +0200 Rolf Eike Beer wrote:

This are some random patches I've lying around here. They are not related to each other

1) Use kcalloc() in drivers/video/aty/atyfb_base.c
2) Initialize filp->private_data only once in em28xx_v4l2_open
3) [Doc] Fix typos in fs/sysfs/file.c
4) [Doc] Document pci_iomap()

Hi,

Please don't make unrelated/random patches look like a patch series.

Quoted 1 line

From Documentation/SubmittingPatches:

(where a "patch series" is an ordered sequence of multiple, related patches)

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

maintainer
#9 lore raw
Quoted 5 lines · On Mon, 9 Jul 2007 14:24:17 -0700 Randy Dunlap <[email protected]> wrote:
Quoted 3 lines · On Sun, 8 Jul 2007 17:53:56 +0200 Rolf Eike Beer wrote:

This are some random patches I've lying around here. They are not related to each other

Quoted 9 lines
Quoted 4 lines

1) Use kcalloc() in drivers/video/aty/atyfb_base.c
2) Initialize filp->private_data only once in em28xx_v4l2_open
3) [Doc] Fix typos in fs/sysfs/file.c
4) [Doc] Document pci_iomap()

Hi,

Please don't make unrelated/random patches look like a patch series.

I tend to have a big panic if sent a pile of patches which have no sequence numbering. So if they are all unrelated, please tell me so.