[MTD] pmc551 whitespace cleanup
Spaces were used for indent, there was more than 80 columns per line. Get rid of that stuff. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
This commit is contained in:
parent
e417fcfb85
commit
cdf0a7d169
|
@ -115,7 +115,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
|
||||||
size_t retlen;
|
size_t retlen;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr, (long)instr->len);
|
printk(KERN_DEBUG "pmc551_erase(pos:%ld, len:%ld)\n", (long)instr->addr,
|
||||||
|
(long)instr->len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end = instr->addr + instr->len - 1;
|
end = instr->addr + instr->len - 1;
|
||||||
|
@ -123,7 +124,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
|
||||||
/* Is it past the end? */
|
/* Is it past the end? */
|
||||||
if (end > mtd->size) {
|
if (end > mtd->size) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n", (long)end, (long)mtd->size);
|
printk(KERN_DEBUG "pmc551_erase() out of bounds (%ld > %ld)\n",
|
||||||
|
(long)end, (long)mtd->size);
|
||||||
#endif
|
#endif
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,8 @@ static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
|
||||||
written. */
|
written. */
|
||||||
while (soff_hi != eoff_hi) {
|
while (soff_hi != eoff_hi) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk( KERN_DEBUG "pmc551_erase() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
printk(KERN_DEBUG "pmc551_erase() soff_hi: %ld, "
|
||||||
|
"eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
||||||
#endif
|
#endif
|
||||||
memset(ptr, 0xff, priv->asize);
|
memset(ptr, 0xff, priv->asize);
|
||||||
if (soff_hi + priv->asize >= mtd->size) {
|
if (soff_hi + priv->asize >= mtd->size) {
|
||||||
|
@ -167,8 +170,8 @@ out:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len,
|
||||||
static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf)
|
size_t * retlen, u_char ** mtdbuf)
|
||||||
{
|
{
|
||||||
struct mypriv *priv = mtd->priv;
|
struct mypriv *priv = mtd->priv;
|
||||||
u32 soff_hi;
|
u32 soff_hi;
|
||||||
|
@ -180,7 +183,8 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *
|
||||||
|
|
||||||
if (from + len > mtd->size) {
|
if (from + len > mtd->size) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n", (long)from+len, (long)mtd->size);
|
printk(KERN_DEBUG "pmc551_point() out of bounds (%ld > %ld)\n",
|
||||||
|
(long)from + len, (long)mtd->size);
|
||||||
#endif
|
#endif
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -200,16 +204,16 @@ static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from,
|
||||||
static void pmc551_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_unpoint()\n");
|
printk(KERN_DEBUG "pmc551_unpoint()\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len,
|
||||||
static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
|
size_t * retlen, u_char * buf)
|
||||||
{
|
{
|
||||||
struct mypriv *priv = mtd->priv;
|
struct mypriv *priv = mtd->priv;
|
||||||
u32 soff_hi, soff_lo; /* start address offset hi/lo */
|
u32 soff_hi, soff_lo; /* start address offset hi/lo */
|
||||||
|
@ -219,7 +223,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
|
||||||
u_char *copyto = buf;
|
u_char *copyto = buf;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n", (long)from, (long)len, (long)priv->asize);
|
printk(KERN_DEBUG "pmc551_read(pos:%ld, len:%ld) asize: %ld\n",
|
||||||
|
(long)from, (long)len, (long)priv->asize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end = from + len - 1;
|
end = from + len - 1;
|
||||||
|
@ -227,7 +232,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
|
||||||
/* Is it past the end? */
|
/* Is it past the end? */
|
||||||
if (end > mtd->size) {
|
if (end > mtd->size) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n", (long) end, (long)mtd->size);
|
printk(KERN_DEBUG "pmc551_read() out of bounds (%ld > %ld)\n",
|
||||||
|
(long)end, (long)mtd->size);
|
||||||
#endif
|
#endif
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -249,7 +255,8 @@ static int pmc551_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *r
|
||||||
written. */
|
written. */
|
||||||
while (soff_hi != eoff_hi) {
|
while (soff_hi != eoff_hi) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk( KERN_DEBUG "pmc551_read() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
printk(KERN_DEBUG "pmc551_read() soff_hi: %ld, "
|
||||||
|
"eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
||||||
#endif
|
#endif
|
||||||
memcpy(copyto, ptr, priv->asize);
|
memcpy(copyto, ptr, priv->asize);
|
||||||
copyto += priv->asize;
|
copyto += priv->asize;
|
||||||
|
@ -271,7 +278,8 @@ out:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf)
|
static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len,
|
||||||
|
size_t * retlen, const u_char * buf)
|
||||||
{
|
{
|
||||||
struct mypriv *priv = mtd->priv;
|
struct mypriv *priv = mtd->priv;
|
||||||
u32 soff_hi, soff_lo; /* start address offset hi/lo */
|
u32 soff_hi, soff_lo; /* start address offset hi/lo */
|
||||||
|
@ -280,16 +288,18 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
|
||||||
u_char *ptr;
|
u_char *ptr;
|
||||||
const u_char *copyfrom = buf;
|
const u_char *copyfrom = buf;
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n", (long)to, (long)len, (long)priv->asize);
|
printk(KERN_DEBUG "pmc551_write(pos:%ld, len:%ld) asize:%ld\n",
|
||||||
|
(long)to, (long)len, (long)priv->asize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end = to + len - 1;
|
end = to + len - 1;
|
||||||
/* Is it past the end? or did the u32 wrap? */
|
/* Is it past the end? or did the u32 wrap? */
|
||||||
if (end > mtd->size) {
|
if (end > mtd->size) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, size: %ld, to: %ld)\n", (long) end, (long)mtd->size, (long)to);
|
printk(KERN_DEBUG "pmc551_write() out of bounds (end: %ld, "
|
||||||
|
"size: %ld, to: %ld)\n", (long)end, (long)mtd->size,
|
||||||
|
(long)to);
|
||||||
#endif
|
#endif
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -311,7 +321,8 @@ static int pmc551_write (struct mtd_info *mtd, loff_t to, size_t len, size_t *re
|
||||||
written. */
|
written. */
|
||||||
while (soff_hi != eoff_hi) {
|
while (soff_hi != eoff_hi) {
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk( KERN_DEBUG "pmc551_write() soff_hi: %ld, eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
printk(KERN_DEBUG "pmc551_write() soff_hi: %ld, "
|
||||||
|
"eoff_hi: %ld\n", (long)soff_hi, (long)eoff_hi);
|
||||||
#endif
|
#endif
|
||||||
memcpy(ptr, copyfrom, priv->asize);
|
memcpy(ptr, copyfrom, priv->asize);
|
||||||
copyfrom += priv->asize;
|
copyfrom += priv->asize;
|
||||||
|
@ -469,8 +480,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
* Wait until command has gone through
|
* Wait until command has gone through
|
||||||
* FIXME: register spinning issue
|
* FIXME: register spinning issue
|
||||||
*/
|
*/
|
||||||
do { pci_read_config_word( dev, PMC551_SDRAM_CMD, &cmd );
|
do {
|
||||||
if(counter++ > 100)break;
|
pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
|
||||||
|
if (counter++ > 100)
|
||||||
|
break;
|
||||||
} while ((PCI_COMMAND_IO) & cmd);
|
} while ((PCI_COMMAND_IO) & cmd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -487,8 +500,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
* FIXME: register spinning issue
|
* FIXME: register spinning issue
|
||||||
*/
|
*/
|
||||||
counter = 0;
|
counter = 0;
|
||||||
do { pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
|
do {
|
||||||
if(counter++ > 100)break;
|
pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
|
||||||
|
if (counter++ > 100)
|
||||||
|
break;
|
||||||
} while ((PCI_COMMAND_IO) & cmd);
|
} while ((PCI_COMMAND_IO) & cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +515,10 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
* FIXME: register spinning issue
|
* FIXME: register spinning issue
|
||||||
*/
|
*/
|
||||||
counter = 0;
|
counter = 0;
|
||||||
do { pci_read_config_word ( dev, PMC551_SDRAM_CMD, &cmd);
|
do {
|
||||||
if(counter++ > 100)break;
|
pci_read_config_word(dev, PMC551_SDRAM_CMD, &cmd);
|
||||||
|
if (counter++ > 100)
|
||||||
|
break;
|
||||||
} while ((PCI_COMMAND_IO) & cmd);
|
} while ((PCI_COMMAND_IO) & cmd);
|
||||||
|
|
||||||
pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd);
|
pci_read_config_dword(dev, PMC551_DRAM_CFG, &dcmd);
|
||||||
|
@ -546,11 +563,13 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
/*
|
/*
|
||||||
* Some screen fun
|
* Some screen fun
|
||||||
*/
|
*/
|
||||||
printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at 0x%llx\n",
|
printk(KERN_DEBUG "pmc551: %d%c (0x%x) of %sprefetchable memory at "
|
||||||
(size<1024)?size:(size<1048576)?size>>10:size>>20,
|
"0x%llx\n", (size < 1024) ? size : (size < 1048576) ?
|
||||||
(size<1024)?'B':(size<1048576)?'K':'M',
|
size >> 10 : size >> 20,
|
||||||
size, ((dcmd&(0x1<<3)) == 0)?"non-":"",
|
(size < 1024) ? 'B' : (size < 1048576) ? 'K' : 'M', size,
|
||||||
(unsigned long long)((dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK));
|
((dcmd & (0x1 << 3)) == 0) ? "non-" : "",
|
||||||
|
(unsigned long long)((dev->resource[0].start) &
|
||||||
|
PCI_BASE_ADDRESS_MEM_MASK));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see the state of the memory
|
* Check to see the state of the memory
|
||||||
|
@ -562,7 +581,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
||||||
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
||||||
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
||||||
((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) );
|
((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7),
|
||||||
|
((dcmd >> 9) & 0xF));
|
||||||
|
|
||||||
pci_read_config_dword(dev, PMC551_DRAM_BLK1, &dcmd);
|
pci_read_config_dword(dev, PMC551_DRAM_BLK1, &dcmd);
|
||||||
printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n"
|
printk(KERN_DEBUG "pmc551: DRAM_BLK1 Flags: %s,%s\n"
|
||||||
|
@ -571,7 +591,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
||||||
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
||||||
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
||||||
((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) );
|
((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7),
|
||||||
|
((dcmd >> 9) & 0xF));
|
||||||
|
|
||||||
pci_read_config_dword(dev, PMC551_DRAM_BLK2, &dcmd);
|
pci_read_config_dword(dev, PMC551_DRAM_BLK2, &dcmd);
|
||||||
printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n"
|
printk(KERN_DEBUG "pmc551: DRAM_BLK2 Flags: %s,%s\n"
|
||||||
|
@ -580,7 +601,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
||||||
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
||||||
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
||||||
((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) );
|
((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7),
|
||||||
|
((dcmd >> 9) & 0xF));
|
||||||
|
|
||||||
pci_read_config_dword(dev, PMC551_DRAM_BLK3, &dcmd);
|
pci_read_config_dword(dev, PMC551_DRAM_BLK3, &dcmd);
|
||||||
printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n"
|
printk(KERN_DEBUG "pmc551: DRAM_BLK3 Flags: %s,%s\n"
|
||||||
|
@ -589,7 +611,8 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
(((0x1 << 1) & dcmd) == 0) ? "RW" : "RO",
|
||||||
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
(((0x1 << 0) & dcmd) == 0) ? "Off" : "On",
|
||||||
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
PMC551_DRAM_BLK_GET_SIZE(dcmd),
|
||||||
((dcmd>>20)&0x7FF), ((dcmd>>13)&0x7), ((dcmd>>9)&0xF) );
|
((dcmd >> 20) & 0x7FF), ((dcmd >> 13) & 0x7),
|
||||||
|
((dcmd >> 9) & 0xF));
|
||||||
|
|
||||||
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
||||||
printk(KERN_DEBUG "pmc551: Memory Access %s\n",
|
printk(KERN_DEBUG "pmc551: Memory Access %s\n",
|
||||||
|
@ -620,7 +643,6 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
|
||||||
* Kernel version specific module stuffages
|
* Kernel version specific module stuffages
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>");
|
MODULE_AUTHOR("Mark Ferrell <mferrell@mvista.com>");
|
||||||
MODULE_DESCRIPTION(PMC551_VERSION);
|
MODULE_DESCRIPTION(PMC551_VERSION);
|
||||||
|
@ -654,7 +676,8 @@ static int __init init_pmc551(void)
|
||||||
if (msize) {
|
if (msize) {
|
||||||
msize = (1 << (ffs(msize) - 1)) << 20;
|
msize = (1 << (ffs(msize) - 1)) << 20;
|
||||||
if (msize > (1 << 30)) {
|
if (msize > (1 << 30)) {
|
||||||
printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n", msize);
|
printk(KERN_NOTICE "pmc551: Invalid memory size [%d]\n",
|
||||||
|
msize);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,7 +685,8 @@ static int __init init_pmc551(void)
|
||||||
if (asize) {
|
if (asize) {
|
||||||
asize = (1 << (ffs(asize) - 1)) << 20;
|
asize = (1 << (ffs(asize) - 1)) << 20;
|
||||||
if (asize > (1 << 30)) {
|
if (asize > (1 << 30)) {
|
||||||
printk(KERN_NOTICE "pmc551: Invalid aperture size [%d]\n", asize);
|
printk(KERN_NOTICE "pmc551: Invalid aperture size "
|
||||||
|
"[%d]\n", asize);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -702,14 +726,16 @@ static int __init init_pmc551(void)
|
||||||
*/
|
*/
|
||||||
if (msize) {
|
if (msize) {
|
||||||
length = msize;
|
length = msize;
|
||||||
printk(KERN_NOTICE "pmc551: Using specified memory size 0x%x\n", length);
|
printk(KERN_NOTICE "pmc551: Using specified memory "
|
||||||
|
"size 0x%x\n", length);
|
||||||
} else {
|
} else {
|
||||||
msize = length;
|
msize = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtd = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
|
mtd = kmalloc(sizeof(struct mtd_info), GFP_KERNEL);
|
||||||
if (!mtd) {
|
if (!mtd) {
|
||||||
printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n");
|
printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
|
||||||
|
"device.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,7 +743,8 @@ static int __init init_pmc551(void)
|
||||||
|
|
||||||
priv = kmalloc(sizeof(struct mypriv), GFP_KERNEL);
|
priv = kmalloc(sizeof(struct mypriv), GFP_KERNEL);
|
||||||
if (!priv) {
|
if (!priv) {
|
||||||
printk(KERN_NOTICE "pmc551: Cannot allocate new MTD device.\n");
|
printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
|
||||||
|
"device.\n");
|
||||||
kfree(mtd);
|
kfree(mtd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -726,13 +753,16 @@ static int __init init_pmc551(void)
|
||||||
priv->dev = PCI_Device;
|
priv->dev = PCI_Device;
|
||||||
|
|
||||||
if (asize > length) {
|
if (asize > length) {
|
||||||
printk(KERN_NOTICE "pmc551: reducing aperture size to fit %dM\n",length>>20);
|
printk(KERN_NOTICE "pmc551: reducing aperture size to "
|
||||||
|
"fit %dM\n", length >> 20);
|
||||||
priv->asize = asize = length;
|
priv->asize = asize = length;
|
||||||
} else if (asize == 0 || asize == length) {
|
} else if (asize == 0 || asize == length) {
|
||||||
printk(KERN_NOTICE "pmc551: Using existing aperture size %dM\n", length>>20);
|
printk(KERN_NOTICE "pmc551: Using existing aperture "
|
||||||
|
"size %dM\n", length >> 20);
|
||||||
priv->asize = asize = length;
|
priv->asize = asize = length;
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_NOTICE "pmc551: Using specified aperture size %dM\n", asize>>20);
|
printk(KERN_NOTICE "pmc551: Using specified aperture "
|
||||||
|
"size %dM\n", asize >> 20);
|
||||||
priv->asize = asize;
|
priv->asize = asize;
|
||||||
}
|
}
|
||||||
priv->start = ioremap(((PCI_Device->resource[0].start)
|
priv->start = ioremap(((PCI_Device->resource[0].start)
|
||||||
|
@ -745,7 +775,6 @@ static int __init init_pmc551(void)
|
||||||
kfree(mtd);
|
kfree(mtd);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_PMC551_DEBUG
|
#ifdef CONFIG_MTD_PMC551_DEBUG
|
||||||
printk(KERN_DEBUG "pmc551: setting aperture to %d\n",
|
printk(KERN_DEBUG "pmc551: setting aperture to %d\n",
|
||||||
ffs(priv->asize >> 20) - 1);
|
ffs(priv->asize >> 20) - 1);
|
||||||
|
@ -777,7 +806,8 @@ static int __init init_pmc551(void)
|
||||||
mtd->owner = THIS_MODULE;
|
mtd->owner = THIS_MODULE;
|
||||||
|
|
||||||
if (add_mtd_device(mtd)) {
|
if (add_mtd_device(mtd)) {
|
||||||
printk(KERN_NOTICE "pmc551: Failed to register new device\n");
|
printk(KERN_NOTICE "pmc551: Failed to register new "
|
||||||
|
"device\n");
|
||||||
iounmap(priv->start);
|
iounmap(priv->start);
|
||||||
kfree(mtd->priv);
|
kfree(mtd->priv);
|
||||||
kfree(mtd);
|
kfree(mtd);
|
||||||
|
@ -790,8 +820,7 @@ static int __init init_pmc551(void)
|
||||||
printk(KERN_NOTICE "Registered pmc551 memory device.\n");
|
printk(KERN_NOTICE "Registered pmc551 memory device.\n");
|
||||||
printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n",
|
printk(KERN_NOTICE "Mapped %dM of memory from 0x%p to 0x%p\n",
|
||||||
priv->asize >> 20,
|
priv->asize >> 20,
|
||||||
priv->start,
|
priv->start, priv->start + priv->asize);
|
||||||
priv->start + priv->asize);
|
|
||||||
printk(KERN_NOTICE "Total memory is %d%c\n",
|
printk(KERN_NOTICE "Total memory is %d%c\n",
|
||||||
(length < 1024) ? length :
|
(length < 1024) ? length :
|
||||||
(length < 1048576) ? length >> 10 : length >> 20,
|
(length < 1048576) ? length >> 10 : length >> 20,
|
||||||
|
@ -828,8 +857,8 @@ static void __exit cleanup_pmc551(void)
|
||||||
pmc551list = priv->nextpmc551;
|
pmc551list = priv->nextpmc551;
|
||||||
|
|
||||||
if (priv->start) {
|
if (priv->start) {
|
||||||
printk (KERN_DEBUG "pmc551: unmapping %dM starting at 0x%p\n",
|
printk(KERN_DEBUG "pmc551: unmapping %dM starting at "
|
||||||
priv->asize>>20, priv->start);
|
"0x%p\n", priv->asize >> 20, priv->start);
|
||||||
iounmap(priv->start);
|
iounmap(priv->start);
|
||||||
}
|
}
|
||||||
pci_dev_put(priv->dev);
|
pci_dev_put(priv->dev);
|
||||||
|
|
Loading…
Reference in New Issue