login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
November
»
8
Re: [PATCH] spi: Fix error paths on txx9spi_probe
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: David Brownell
Subject:
Re: [PATCH] spi: Fix error paths on txx9spi_probe
Date: Thursday, November 8, 2007 - 11:46 am
On Thursday 08 November 2007, Atsushi Nemoto wrote:
quoted text
> Some error paths in txx9spi_probe wrongly return 0. This patch fixes > them by using the devres interfaces. > > Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
ACK
quoted text
> --- > drivers/spi/spi_txx9.c | 40 ++++++++++++++++++++-------------------- > 1 files changed, 20 insertions(+), 20 deletions(-) > > diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c > index cc5094f..363ac8e 100644 > --- a/drivers/spi/spi_txx9.c > +++ b/drivers/spi/spi_txx9.c > @@ -24,6 +24,7 @@ > #include <linux/spi/spi.h> > #include <linux/err.h> > #include <linux/clk.h> > +#include <linux/io.h> > #include <asm/gpio.h> > > > @@ -74,7 +75,6 @@ struct txx9spi { > struct list_head queue; > wait_queue_head_t waitq; > void __iomem *membase; > - int irq; > int baseclk; > struct clk *clk; > u32 max_speed_hz, min_speed_hz; > @@ -350,12 +350,12 @@ static int __init txx9spi_probe(struct platform_device *dev) > struct resource *res; > int ret = -ENODEV; > u32 mcr; > + int irq; > > master = spi_alloc_master(&dev->dev, sizeof(*c)); > if (!master) > return ret; > c = spi_master_get_devdata(master); > - c->irq = -1; > platform_set_drvdata(dev, master); > > INIT_WORK(&c->work, txx9spi_work); > @@ -381,32 +381,36 @@ static int __init txx9spi_probe(struct platform_device *dev) > > res = platform_get_resource(dev, IORESOURCE_MEM, 0); > if (!res) > - goto exit; > - c->membase = ioremap(res->start, res->end - res->start + 1); > + goto exit_busy; > + if (!devm_request_mem_region(&dev->dev, > + res->start, res->end - res->start + 1, > + "spi_txx9")) > + goto exit_busy; > + c->membase = devm_ioremap(&dev->dev, > + res->start, res->end - res->start + 1); > if (!c->membase) > - goto exit; > + goto exit_busy; > > /* enter config mode */ > mcr = txx9spi_rd(c, TXx9_SPMCR); > mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR); > txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR); > > - c->irq = platform_get_irq(dev, 0); > - if (c->irq < 0) > - goto exit; > - ret = request_irq(c->irq, txx9spi_interrupt, 0, dev->name, c); > - if (ret) { > - c->irq = -1; > + irq = platform_get_irq(dev, 0); > + if (irq < 0) > + goto exit_busy; > + ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0, > + "spi_txx9", c); > + if (ret) > goto exit; > - } > > c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); > if (!c->workqueue) > - goto exit; > + goto exit_busy; > c->last_chipselect = -1; > > dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n", > - (unsigned long long)res->start, c->irq, > + (unsigned long long)res->start, irq, > (c->baseclk + 500000) / 1000000); > > master->bus_num = dev->id; > @@ -418,13 +422,11 @@ static int __init txx9spi_probe(struct platform_device *dev) > if (ret) > goto exit; > return 0; > +exit_busy: > + ret = -EBUSY; > exit: > if (c->workqueue) > destroy_workqueue(c->workqueue); > - if (c->irq >= 0) > - free_irq(c->irq, c); > - if (c->membase) > - iounmap(c->membase); > if (c->clk) { > clk_disable(c->clk); > clk_put(c->clk); > @@ -442,8 +444,6 @@ static int __exit txx9spi_remove(struct platform_device *dev) > spi_unregister_master(master); > platform_set_drvdata(dev, NULL); > destroy_workqueue(c->workqueue); > - free_irq(c->irq, c); > - iounmap(c->membase); > clk_disable(c->clk); > clk_put(c->clk); > spi_master_put(master); >
-
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] spi: Fix error paths on txx9spi_probe
, Atsushi Nemoto
, (Thu Nov 8, 7:35 am)
Re: [PATCH] spi: Fix error paths on txx9spi_probe
, David Brownell
, (Thu Nov 8, 11:46 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Rusty Russell
Re: 2.6.22-rc3-mm1
Gautham R Shenoy
[PATCH 1/8] Enhance process freezer interface for usage beyond software suspend
Jeffrey V. Merkey
Re: Versioning file system
James Bottomley
Re: [PATCH -mm 1/2] scsi: remove dma_is_consistent usage in 53c700
David Miller
Re: NO_HZ: timer interrupt stuck
git
:
Oliver Kullmann
Re: how to move with history?
Junio C Hamano
Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing
Shawn O. Pearce
Re: Bugs in Gitosis
Miles Bader
Re: way to automatically add untracked files?
Harvey Harrison
Re: [SoC RFC] libsvn-fs-git: A git backend for the subversion filesystem
git-commits-head
:
Linux Kernel Mailing List
V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer
Linux Kernel Mailing List
OMAP: DSS2: SDI driver
Linux Kernel Mailing List
PCI: introduce pci_pcie_cap()
Linux Kernel Mailing List
netfilter: nf_conntrack_sip: add T.38 FAX support
Linux Kernel Mailing List
drivers/acpi: use kasprintf
linux-netdev
:
Timo Teräs
ip xfrm policy semantics
David Miller
Re: [2.6.30-rc3] powerpc: compilation error of mace module
Patrick McHardy
Re: [rfc 02/13] [RFC 02/13] netfilter: nf_conntrack_sip: Add callid parser
webmaster Maintenance
&#32852;&#31995;&#31995;&#32479;&#31649;&#29702;&#21592;
Krzysztof Oledzki
Re: Error: an inet prefix is expected rather than "0/0".
openbsd-misc
:
Ted Bullock
Re: Proliant DL380 G3 cannot get on network
Úlfar M. E. Johnson
installing openbsd in xen
Eric Furman
Re: Defending OpenBSD Performance
Damien Miller
Re: Patching a SSH 'Weakness'
Nick Holland
Re: 1 out of 3 hunks failed--saving rejects to kerberosV/src/lib/krb5/crypto.c.rej
Colocation donated by:
Syndicate