Re: [PATCH net-next v2 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x
Wolfgang Grandegger wrote: > This patch series adds support for the MPC512x from Freescale to > the mpc5xxx_can MSCAN driver. > > Changes since v1: > > - Various coding style issues, printk formats, variable names and > error messagaes and typos fixes or improved > > - MPC5xxx specific data are now passed to mpc5xxx_can_probe() via > "of_device_id->data". > > - The index of the MPC512x CAN controller is now derived directly > from reg property. This allows use of_iomap() as usual. > > - It has been documented that MPC512x Rev.1 CPUs are not supported. As you might have already realized, this patch set slipped out accidentally to the mailing list due to a bug in my patch-format-test-and-send-email script. Nevertheless, it's good enough for reviewing and testing. Just some debugging code needs to be removed. Wolfram, is it OK from your point of view now? I will roll out v3 after some more thorough testing tomorrow. Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH net-next v2 1/3] can: mscan: fix improper return if dlc < 8 in start_xmit function
On Tue, Jan 05, 2010 at 08:19:27PM +0100, Wolfgang Grandegger wrote: > From: Wolfgang Grandegger > > The start_xmit function of the MSCAN Driver did return improperly if > the CAN dlc check failed (skb not freed and invalid return code). This > patch adds a proper check of the frame lenght and data size and returns > now correctly. Furthermore, a typo has been fixed. > > Signed-off-by: Wolfgang Grandegger > Acked-by: Wolfram Sang > --- > drivers/net/can/mscan/mscan.c | 11 --- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c > index bb06dfb..7df950e 100644 > --- a/drivers/net/can/mscan/mscan.c > +++ b/drivers/net/can/mscan/mscan.c > @@ -4,7 +4,7 @@ > * Copyright (C) 2005-2006 Andrey Volkov , > * Varma Electronics Oy > * Copyright (C) 2008-2009 Wolfgang Grandegger > - * Copytight (C) 2008-2009 Pengutronix > + * Copyright (C) 2008-2009 Pengutronix > * > * This program is free software; you can redistribute it and/or modify > * it under the terms of the version 2 of the GNU General Public License > @@ -177,8 +177,13 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, > struct net_device *dev) > int i, rtr, buf_id; > u32 can_id; > > - if (frame->can_dlc > 8) > - return -EINVAL; > + if (skb->len != sizeof(*frame) || frame->can_dlc > 8) { > + dev_err(dev->dev.parent, > + "Dropping non-conform packet: len %u, can_dlc %u\n", > + skb->len, frame->can_dlc); > + kfree_skb(skb); > + return NETDEV_TX_OK; Double space. > + } > > out_8(®s->cantier, 0); > > -- > 1.6.2.5 > -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH net-next v2 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x
> Wolfram, is it OK from your point of view now? I will roll out v3 after > some more thorough testing tomorrow. It still works here and, as I see it, all issues were resolved as discussed. Thanks, Wolfram -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: How to set GPIO state in the dts or in platform
Ayman El-Khashab wrote: > On 1/5/2010 10:38 PM, Bill Gatliff wrote: >> Ayman El-Khashab wrote: >> >>> I've got a custom board akin to the walnut. I've successfully got >>> u-boot, >>> the kernel, and a working filesystem. The only thing I lack is a >>> clear idea >>> of how to set a GPIO. >>> >> >> Isn't that the "flags" parameter, e.g.: >> >> gpios = >> >> ? >> >> If you are passing a 0 for the flags, try a 1. I know of at least one >> driver that interprets that to mean a polarity inversion. Maybe you'll >> get lucky. :) >> >> > Possibly, I saw that in the documentation directory, but didn't quite > follow the explanation that > was given. Below is what I was using as a reference, but is it as > simple as that? Do the flags encode > just the state or also, the open drain, hi-z and everything else? In > my case, I want the GPIO 3 actively > driven high. The flags can encode everything, or nothing. It all depends on what the caller of of_get_gpio_flags() does with them. (Note that I'm not an authority on this topic, I'm just telling what I've learned about it recently). For example, in of_mpc8xxx_spi_get_chipselects(), the flag is tested against OF_GPIO_ACTIVE_LOW, and the result is passed to gpio_direction_output() as the initial value. So it both inverts the sense of the pin, and sets its initial state. In of_gpio_leds_probe(), the flag is tested against OF_GPIO_ACTIVE_LOW as well. In both of the above examples, the drivers can make assumptions about things like the pin must be an output, will be actively driven in either direction, and so on. The convention is for the flag to be a bitmap of values from the of_gpio_flags enumeration, but the only value there is--- you guessed it--- OF_GPIO_ACTIVE_LOW. :) If you provide your own xlate() function in a of_gpio_chip driver, you can make the flags mean anything you want. As for anywhere you call of_gpio_get_flags(). For now, the only established interpretation is the OF_GPIO_ACTIVE_LOW one. b.g. -- Bill Gatliff Embedded systems training and consulting http://billgatliff.com b...@billgatliff.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH net-next v2 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x
Wolfram Sang wrote: >> Wolfram, is it OK from your point of view now? I will roll out v3 after >> some more thorough testing tomorrow. > > It still works here and, as I see it, all issues were resolved as discussed. OK, fine if I add your acked-by then? Thanks, Wolfgang. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] spi_mpc8xxx: fix WARN_ON on remove after 4c1fba44296
Commit 4c1fba44296 (Add support for QE DMA mode and CPM1/CPM2 chips) added unconditional calls to _cpm_init() / _cpm_free() from probe()/remove(), but only checked if we're actually using CPM mode in _init(), causing the WARN_ON in mpc8xxx_spi_free_dummy_rx() for !CPM. Fix it by adding the same check in _cpm_free() as well. Signed-off-by: Peter Korsgaard --- drivers/spi/spi_mpc8xxx.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi_mpc8xxx.c b/drivers/spi/spi_mpc8xxx.c index 1fb2a6e..0604d6b 100644 --- a/drivers/spi/spi_mpc8xxx.c +++ b/drivers/spi/spi_mpc8xxx.c @@ -946,6 +946,9 @@ static void mpc8xxx_spi_cpm_free(struct mpc8xxx_spi *mspi) { struct device *dev = mspi->dev; + if (!(mspi->flags & SPI_CPM_MODE)) + return 0; + dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE); dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE); cpm_muram_free(cpm_muram_offset(mspi->tx_bd)); -- 1.6.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH net-next v2 0/3] can: mscan-mpc5xxx: add support for the Freescale MPC512x
> > It still works here and, as I see it, all issues were resolved as discussed. > > OK, fine if I add your acked-by then? I wanted to add a 'Reviewed-by' after I checked V3. Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] PPC: use helpers for rlimits
Make sure compiler won't do weird things with limits. E.g. fetching them twice may return 2 different values after writable limits are implemented. I.e. either use rlimit helpers added in 3e10e716abf3c71bdb5d86b8f507f9e72236c9cd or ACCESS_ONCE if not applicable. Signed-off-by: Jiri Slaby Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-...@ozlabs.org --- arch/powerpc/mm/mmap_64.c|4 ++-- arch/powerpc/platforms/cell/spufs/coredump.c |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c index 0d957a4..5a783d8 100644 --- a/arch/powerpc/mm/mmap_64.c +++ b/arch/powerpc/mm/mmap_64.c @@ -47,7 +47,7 @@ static inline int mmap_is_legacy(void) if (current->personality & ADDR_COMPAT_LAYOUT) return 1; - if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY) + if (rlimit(RLIMIT_STACK) == RLIM_INFINITY) return 1; return sysctl_legacy_va_layout; @@ -77,7 +77,7 @@ static unsigned long mmap_rnd(void) static inline unsigned long mmap_base(void) { - unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; + unsigned long gap = rlimit(RLIMIT_STACK); if (gap < MIN_GAP) gap = MIN_GAP; diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index c4d4a19..eea1202 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c @@ -54,7 +54,7 @@ static ssize_t do_coredump_read(int num, struct spu_context *ctx, void *buffer, */ static int spufs_dump_write(struct file *file, const void *addr, int nr, loff_t *foffset) { - unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur; + unsigned long limit = rlimit(RLIMIT_CORE); ssize_t written; if (*foffset + nr > limit) -- 1.6.5.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[git pull] defconfig updates
The following changes since commit 74d2e4f8d79ae0c4b6ec027958d5b18058662eea: Linus Torvalds (1): Linux 2.6.33-rc3 are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git merge Kumar Gala (1): powerpc: 2.6.33 update of defconfigs for embedded 6xx/7xxx, 8xx, 8xxx arch/powerpc/configs/83xx/asp8347_defconfig | 88 +- arch/powerpc/configs/83xx/kmeter1_defconfig | 68 +++--- arch/powerpc/configs/83xx/mpc8313_rdb_defconfig | 97 +++- arch/powerpc/configs/83xx/mpc8315_rdb_defconfig | 100 +++- arch/powerpc/configs/83xx/mpc832x_mds_defconfig | 89 +- arch/powerpc/configs/83xx/mpc832x_rdb_defconfig | 93 ++- arch/powerpc/configs/83xx/mpc834x_itx_defconfig | 95 ++- arch/powerpc/configs/83xx/mpc834x_itxgp_defconfig | 92 ++- arch/powerpc/configs/83xx/mpc834x_mds_defconfig | 86 +- arch/powerpc/configs/83xx/mpc836x_mds_defconfig | 89 +- arch/powerpc/configs/83xx/mpc836x_rdk_defconfig | 87 +- arch/powerpc/configs/83xx/mpc837x_mds_defconfig | 89 +- arch/powerpc/configs/83xx/mpc837x_rdb_defconfig | 91 ++- arch/powerpc/configs/83xx/sbc834x_defconfig | 85 +- arch/powerpc/configs/85xx/ksi8560_defconfig | 69 +++--- arch/powerpc/configs/85xx/mpc8540_ads_defconfig | 69 +++--- arch/powerpc/configs/85xx/mpc8560_ads_defconfig | 76 arch/powerpc/configs/85xx/mpc85xx_cds_defconfig | 75 arch/powerpc/configs/85xx/sbc8548_defconfig | 77 arch/powerpc/configs/85xx/sbc8560_defconfig | 72 +++--- arch/powerpc/configs/85xx/socrates_defconfig | 99 +++- arch/powerpc/configs/85xx/stx_gp3_defconfig | 87 +- arch/powerpc/configs/85xx/tqm8540_defconfig | 89 +- arch/powerpc/configs/85xx/tqm8541_defconfig | 90 +- arch/powerpc/configs/85xx/tqm8548_defconfig | 95 +++ arch/powerpc/configs/85xx/tqm8555_defconfig | 90 +- arch/powerpc/configs/85xx/tqm8560_defconfig | 90 +- arch/powerpc/configs/85xx/xes_mpc85xx_defconfig | 103 arch/powerpc/configs/86xx/gef_ppc9a_defconfig | 102 arch/powerpc/configs/86xx/gef_sbc310_defconfig| 99 arch/powerpc/configs/86xx/gef_sbc610_defconfig| 92 ++ arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig | 88 ++ arch/powerpc/configs/86xx/mpc8641_hpcn_defconfig | 90 ++ arch/powerpc/configs/86xx/sbc8641d_defconfig | 81 arch/powerpc/configs/adder875_defconfig | 57 +--- arch/powerpc/configs/c2k_defconfig| 90 +- arch/powerpc/configs/ep8248e_defconfig| 64 ++--- arch/powerpc/configs/ep88xc_defconfig | 55 +--- arch/powerpc/configs/linkstation_defconfig| 96 +++- arch/powerpc/configs/mgcoge_defconfig | 74 +++ arch/powerpc/configs/mgsuvd_defconfig | 63 ++--- arch/powerpc/configs/mpc7448_hpc2_defconfig | 79 arch/powerpc/configs/mpc8272_ads_defconfig| 70 +++--- arch/powerpc/configs/mpc83xx_defconfig| 92 ++- arch/powerpc/configs/mpc85xx_defconfig| 97 +++- arch/powerpc/configs/mpc85xx_smp_defconfig| 97 +++- arch/powerpc/configs/mpc866_ads_defconfig | 65 ++--- arch/powerpc/configs/mpc86xx_defconfig| 93 ++ arch/powerpc/configs/mpc885_ads_defconfig | 55 +--- arch/powerpc/configs/pq2fads_defconfig| 72 +++--- arch/powerpc/configs/prpmc2800_defconfig | 94 ++- arch/powerpc/configs/storcenter_defconfig | 86 + 52 files changed, 3351 insertions(+), 1030 deletions(-) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: i2c_powermac: Kernel access of bad area
Hi Christian, hi Ben, On Tue, 29 Dec 2009 20:34:15 +1100, Benjamin Herrenschmidt wrote: > On Mon, 2009-12-28 at 20:40 -0800, Christian Kujau wrote: > > Hi there, > > > > I was trying to find out if I still need i2c_powermac to get details off > > /sys/devices/temperatures, since lm-sensors isn't working for me anyway. This is because the macintosh/therm_adt746x driver doesn't follow the standard hwmon sysfs interface. I would love to see that change. > > After unloading this module, I noticed that reading certain objects would > > fail with a segfault on the prompt and an Oops in the kernel log: > > Definitely looks like we fail to clean things up on remove. Indeed. > I don't have much time to look into this right now, so best is you file > a bug report on bugzilla.kernel.org, make sure I'm CCed. > > Jean (added on CC), in case you already know what's up, please share :-) I don't know anything about this for now. But I'll help if I can. Christian, did you happen to try removing the i2c-powermac driver before? I am curious if this is a recent problem, possibly caused by changes to the i2c stack, or if older kernels already had this problem and nobody ever noticed. I suspect the latter. Looking at drivers/macintosh/therm_adt746x.c, the sysfs files are created in thermostat_init() and removed in thermostat_exit(), which are the driver's init and exit functions. These files are backed-up by a per-device structure, so it looks like the wrong thing to do. I think this is the problem: the sysfs files have a lifetime longer than the data structure that is backing it up. This is somewhat different from "we fail to clean things up on remove": I suspect that even if i2c-powermac was never ever loaded, the same problem would happen. I think that sysfs files creation should be moved to the end of probe_thermostat() and sysfs files removal should be moved to the beginning of remove_thermostat(). Something like the totally untested patch below (no ppc machine at hand): --- drivers/macintosh/therm_adt746x.c | 34 -- 1 file changed, 24 insertions(+), 10 deletions(-) --- linux-2.6.33-rc3.orig/drivers/macintosh/therm_adt746x.c 2010-01-06 17:30:48.0 +0100 +++ linux-2.6.33-rc3/drivers/macintosh/therm_adt746x.c 2010-01-06 17:36:35.0 +0100 @@ -90,6 +90,8 @@ static struct task_struct *thread_therm static void write_both_fan_speed(struct thermostat *th, int speed); static void write_fan_speed(struct thermostat *th, int speed, int fan); +static void thermostat_create_files(void); +static void thermostat_remove_files(void); static int write_reg(struct thermostat* th, int reg, u8 data) @@ -161,6 +163,8 @@ remove_thermostat(struct i2c_client *cli struct thermostat *th = i2c_get_clientdata(client); int i; + thermostat_remove_files(); + if (thread_therm != NULL) { kthread_stop(thread_therm); } @@ -449,6 +453,8 @@ static int probe_thermostat(struct i2c_c return -ENOMEM; } + thermostat_create_files(); + return 0; } @@ -566,7 +572,6 @@ thermostat_init(void) struct device_node* np; const u32 *prop; int i = 0, offset = 0; - int err; np = of_find_node_by_name(NULL, "fan"); if (!np) @@ -633,6 +638,17 @@ thermostat_init(void) return -ENODEV; } +#ifndef CONFIG_I2C_POWERMAC + request_module("i2c-powermac"); +#endif + + return i2c_add_driver(&thermostat_driver); +} + +static void thermostat_create_files(void) +{ + int err; + err = device_create_file(&of_dev->dev, &dev_attr_sensor1_temperature); err |= device_create_file(&of_dev->dev, &dev_attr_sensor2_temperature); err |= device_create_file(&of_dev->dev, &dev_attr_sensor1_limit); @@ -647,16 +663,9 @@ thermostat_init(void) if (err) printk(KERN_WARNING "Failed to create tempertaure attribute file(s).\n"); - -#ifndef CONFIG_I2C_POWERMAC - request_module("i2c-powermac"); -#endif - - return i2c_add_driver(&thermostat_driver); } -static void __exit -thermostat_exit(void) +static void thermostat_remove_files(void) { if (of_dev) { device_remove_file(&of_dev->dev, &dev_attr_sensor1_temperature); @@ -673,9 +682,14 @@ thermostat_exit(void) device_remove_file(&of_dev->dev, &dev_attr_sensor2_fan_speed); - of_device_unregister(of_dev); } +} + +static void __exit +thermostat_exit(void) +{ i2c_del_driver(&thermostat_driver); + of_device_unregister(of_dev); } module_init(thermostat_init); -- Jean Delvare ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 6/8] fsldma: simplify IRQ probing and handling
On Thu, Dec 31, 2009 at 10:10:44PM -0800, Ira W. Snyder wrote: > The IRQ probing is needlessly complex. All off the 83xx device trees in > arch/powerpc/boot/dts/ specify 5 interrupts per DMA controller: one for the > controller, and one for each channel. These interrupts are all attached to > the same IRQ line. The reason for this was to accommodate different types of drivers. A driver may want to only care about one channel (e.g. if that channel is used for something specific such as audio), in which case it can just look at the channel node. A driver that handles multiple channels, OTOH, may want to only register one interrupt handler that processes all channels, possibly using the summary register, on chips that do not have a different interrupt per channel. Such drivers would register the controller interrupt if there is one -- and if so, it would ignore the channel interrupts. > This causes an interesting situation if two channels interrupt at the same > time. The controller's handler will handle the first channel, and the > channel handler will handle the remaining channels. The driver should not be registering handlers for both the controller interrupt and the channel interrupt. It looks like the other problem is that the controller interrupt handler is assuming only one bit will be set in the summary register. It should call the channel handler for each bit that is set. > The same can be accomplished on 83xx by removing the controller's interrupt > property from the device tree. Testing has not shown any problems with this > configuration. Yes, it will work, but the overhead is a little higher than if you only had the one handler and used the summary register. > All in-tree device trees already have an interrupt property > specified for each channel. > > Signed-off-by: Ira W. Snyder > --- > Documentation/powerpc/dts-bindings/fsl/dma.txt | 17 +--- > drivers/dma/fsldma.c | 49 > +++- > 2 files changed, 25 insertions(+), 41 deletions(-) > > diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt > b/Documentation/powerpc/dts-bindings/fsl/dma.txt > index 0732cdd..d5d2d3d 100644 > --- a/Documentation/powerpc/dts-bindings/fsl/dma.txt > +++ b/Documentation/powerpc/dts-bindings/fsl/dma.txt > @@ -12,6 +12,9 @@ Required properties: > - ranges : Should be defined as specified in 1) to describe the > DMA controller channels. > - cell-index: controller index. 0 for controller @ 0x8100 > + > +Optional properties: > + > - interrupts: > - interrupt-parent : optional, if needed for interrupt mapping > > @@ -23,11 +26,7 @@ Required properties: >"fsl,elo-dma-channel". However, see note below. > - reg : > - cell-index: dma channel index starts at 0. > - > -Optional properties: > - interrupts: > - (on 83xx this is expected to be identical to > -the interrupts property of the parent node) It should indeed be the controller interrupt that is optional, but why remove the comment about 83xx? That's the only time you'll have a controller interrupt at all. > - interrupt-parent : optional, if needed for interrupt mapping > > Example: > @@ -37,28 +36,34 @@ Example: > compatible = "fsl,mpc8349-dma", "fsl,elo-dma"; > reg = <0x82a8 4>; > ranges = <0 0x8100 0x1a4>; > - interrupt-parent = <&ipic>; > - interrupts = <71 8>; > cell-index = <0>; > dma-chan...@0 { > compatible = "fsl,mpc8349-dma-channel", > "fsl,elo-dma-channel"; > cell-index = <0>; > reg = <0 0x80>; > + interrupt-parent = <&ipic>; > + interrupts = <71 8>; > }; > dma-chan...@80 { > compatible = "fsl,mpc8349-dma-channel", > "fsl,elo-dma-channel"; > cell-index = <1>; > reg = <0x80 0x80>; > + interrupt-parent = <&ipic>; > + interrupts = <71 8>; > }; > dma-chan...@100 { > compatible = "fsl,mpc8349-dma-channel", > "fsl,elo-dma-channel"; > cell-index = <2>; > reg = <0x100 0x80>; > + interrupt-parent = <&ipic>; > + interrupts = <71 8>; > }; > dma-chan...@180 { > compatible = "fsl,mpc8349-dma-channel", > "fsl,elo-dma-channel"; > cell-index = <3>; > reg = <0x180 0x80>; > + interrupt-parent = <&ipic>; > + interrupts = <71 8>; I'd rather the example provide both controller and channel interrupts. -Scott ___
Re: [PATCH 7/8] fsldma: rename fsl_chan to fchan
On Thu, Dec 31, 2009 at 10:10:45PM -0800, Ira W. Snyder wrote: > The name fsl_chan seems too long, so it has been shortened to fchan. Could be just "chan", no need for namespacing here. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 7/8] fsldma: rename fsl_chan to fchan
On Wed, Jan 06, 2010 at 12:04:22PM -0600, Scott Wood wrote: > On Thu, Dec 31, 2009 at 10:10:45PM -0800, Ira W. Snyder wrote: > > The name fsl_chan seems too long, so it has been shortened to fchan. > > Could be just "chan", no need for namespacing here. > True. A few functions have a parameter "struct dma_chan *chan" from the DMAEngine API. I tried to keep the name different to avoid confusing readers of the code. Would you recommend changing everything to "struct fsldma_chan *chan", and changing to "struct dma_chan *_chan" for the DMAEngine stuff? It seems fine to me, and the compiler will warn about mismatched types if you screw something up. The struct dma_chan isn't used for anything except container_of() anyway. Ira ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 7/8] fsldma: rename fsl_chan to fchan
Ira W. Snyder wrote: On Wed, Jan 06, 2010 at 12:04:22PM -0600, Scott Wood wrote: On Thu, Dec 31, 2009 at 10:10:45PM -0800, Ira W. Snyder wrote: The name fsl_chan seems too long, so it has been shortened to fchan. Could be just "chan", no need for namespacing here. True. A few functions have a parameter "struct dma_chan *chan" from the DMAEngine API. I tried to keep the name different to avoid confusing readers of the code. Ah, I see. I suppose "fchan" is OK in that case, or "priv", or call the dma_chan "dchan", etc. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 6/8] fsldma: simplify IRQ probing and handling
On Wed, Jan 06, 2010 at 12:02:26PM -0600, Scott Wood wrote: > On Thu, Dec 31, 2009 at 10:10:44PM -0800, Ira W. Snyder wrote: > > The IRQ probing is needlessly complex. All off the 83xx device trees in > > arch/powerpc/boot/dts/ specify 5 interrupts per DMA controller: one for the > > controller, and one for each channel. These interrupts are all attached to > > the same IRQ line. > > The reason for this was to accommodate different types of drivers. A driver > may want to only care about one channel (e.g. if that channel is used for > something specific such as audio), in which case it can just look at the > channel node. > > A driver that handles multiple channels, OTOH, may want to only register one > interrupt handler that processes all channels, possibly using the summary > register, on chips that do not have a different interrupt per channel. Such > drivers would register the controller interrupt if there is one -- and if > so, it would ignore the channel interrupts. > Ok. The original driver didn't do this, FYI. It would register all 5 interrupts: 1 controller + 4 channels. It is easy enough to have it completely ignore per-channel interrupts if there is a controller interrupt. I don't think this would break any existing hardware. The 83xx all shares one IRQ line, and the 85xx/86xx only have per-channel interrupts, right? (I'm not an 85xx/86xx guy, I've only got 83xx experience). This is what the device trees suggest, anyway. > > This causes an interesting situation if two channels interrupt at the same > > time. The controller's handler will handle the first channel, and the > > channel handler will handle the remaining channels. > > The driver should not be registering handlers for both the controller > interrupt and the channel interrupt. > > It looks like the other problem is that the controller interrupt handler > is assuming only one bit will be set in the summary register. It should > call the channel handler for each bit that is set. > Ok. I thought about doing this, but my changed approach seemed easier. On the 83xx, we should only need to call the per-channel handler once for each group of 8 bits. The original code used ffs(), which seems a little wrong. Why call the handler twice if both EOSI and EOCDI are set for a channel? Should I use a loop + mask, or is there some other neat trick I can use? > > The same can be accomplished on 83xx by removing the controller's interrupt > > property from the device tree. Testing has not shown any problems with this > > configuration. > > Yes, it will work, but the overhead is a little higher than if you only had > the one handler and used the summary register. > Ok. All of the in-tree 83xx device trees have 5 interrupts listed. With the changes described above, we'll only call request_irq() once in that case, and use the per-controller interrupt. I'll leave the documentation alone, with the exception of marking the per-controller interrupt optional. Ira > > All in-tree device trees already have an interrupt property > > specified for each channel. > > > > Signed-off-by: Ira W. Snyder > > --- > > Documentation/powerpc/dts-bindings/fsl/dma.txt | 17 +--- > > drivers/dma/fsldma.c | 49 > > +++- > > 2 files changed, 25 insertions(+), 41 deletions(-) > > > > diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt > > b/Documentation/powerpc/dts-bindings/fsl/dma.txt > > index 0732cdd..d5d2d3d 100644 > > --- a/Documentation/powerpc/dts-bindings/fsl/dma.txt > > +++ b/Documentation/powerpc/dts-bindings/fsl/dma.txt > > @@ -12,6 +12,9 @@ Required properties: > > - ranges : Should be defined as specified in 1) to describe the > > DMA controller channels. > > - cell-index: controller index. 0 for controller @ 0x8100 > > + > > +Optional properties: > > + > > - interrupts: > > - interrupt-parent : optional, if needed for interrupt mapping > > > > @@ -23,11 +26,7 @@ Required properties: > > "fsl,elo-dma-channel". However, see note below. > > - reg : > > - cell-index: dma channel index starts at 0. > > - > > -Optional properties: > > - interrupts: > > - (on 83xx this is expected to be identical to > > - the interrupts property of the parent node) > > It should indeed be the controller interrupt that is optional, but why > remove the comment about 83xx? That's the only time you'll have a > controller interrupt at all. > > > - interrupt-parent : optional, if needed for interrupt mapping > > > > Example: > > @@ -37,28 +36,34 @@ Example: > > compatible = "fsl,mpc8349-dma", "fsl,elo-dma"; > > reg = <0x82a8 4>; > > ranges = <0 0x8100 0x1a4>; > > - interrupt-parent = <&ipic>; > > - interrupts = <71 8>; > > cell-index = <0>; > > d
Re: [PATCH 7/8] fsldma: rename fsl_chan to fchan
On Wed, Jan 06, 2010 at 12:27:11PM -0600, Scott Wood wrote: > Ira W. Snyder wrote: > > On Wed, Jan 06, 2010 at 12:04:22PM -0600, Scott Wood wrote: > >> On Thu, Dec 31, 2009 at 10:10:45PM -0800, Ira W. Snyder wrote: > >>> The name fsl_chan seems too long, so it has been shortened to fchan. > >> Could be just "chan", no need for namespacing here. > >> > > > > True. A few functions have a parameter "struct dma_chan *chan" from the > > DMAEngine API. I tried to keep the name different to avoid confusing > > readers of the code. > > Ah, I see. > > I suppose "fchan" is OK in that case, or "priv", or call the dma_chan > "dchan", etc. > Using "priv" is fine with me too, I use that style in a lot of the code I write. I'll try "chan", and see how it works out. Ira ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: i2c_powermac: Kernel access of bad area
On Wed, 6 Jan 2010 at 17:37, Jean Delvare wrote: > Christian, did you happen to try removing the i2c-powermac driver > before? Well, I definitely removed the driver before, but I'm not sure if I ever read the /sys files after doing this :-\ > I am curious if this is a recent problem, possibly caused by > changes to the i2c stack, or if older kernels already had this problem > and nobody ever noticed. I suspect the latter. Fair question, but I really could't tell. I realize a bisection would be helpful, but I don't think I'll have to time to do this on this machine (it's a PowerBook G4, but kernel still compilation usually takes ~30min) and I'm not sure that I care _that_ much about this particular issue. I just wanted to report this one, for the sake of the archives, as noone else seems to be bothered by it anyway... > I think that sysfs files creation should be moved to the end of > probe_thermostat() and sysfs files removal should be moved to the > beginning of remove_thermostat(). Something like the totally untested > patch below (no ppc machine at hand): OK, thanks Jean - I'll give it a try later today and let you know. Thanks again, Christian. -- BOFH excuse #398: Data for intranet got routed through the extranet and landed on the internet. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] Create an of_i2c_gpiochip_add()
Bill Gatliff wrote: > This patch series creates an of_i2c_gpiochip_add() function, to allow > i2c-based GPIO expanders to work with device tree gpio specifications. > So nobody has any yays or nays on this? I was expecting at least _something_! :) Does the lack of response mean I'll be seeing these in an upcoming kernel release? I'd like to, because then I could more easily push through related updates to a few i2c device drivers that I have in my local repo. b.g. -- Bill Gatliff Embedded systems training and consulting http://billgatliff.com b...@billgatliff.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] Create an of_i2c_gpiochip_add()
> Does the lack of response mean I'll be seeing these in an upcoming > kernel release? I'd like to, because then I could more easily push As long as nobody said "I picked it up", it will probably not. Patches regarding GPIO sometimes need a bit of time. Also, of_platform was in the discussion of being removed, this might complicate things, too. Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/2] Create an of_i2c_gpiochip_add()
Wolfram Sang wrote: >> Does the lack of response mean I'll be seeing these in an upcoming >> kernel release? I'd like to, because then I could more easily push >> > > As long as nobody said "I picked it up", it will probably not. Patches > regarding GPIO sometimes need a bit of time. Also, of_platform was in the > discussion of being removed, this might complicate things, too. > Is this the right mailing list for such patches, though? b.g. -- Bill Gatliff Embedded systems training and consulting http://billgatliff.com b...@billgatliff.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 6/8] fsldma: simplify IRQ probing and handling
Ira W. Snyder wrote: I don't think this would break any existing hardware. The 83xx all shares one IRQ line, and the 85xx/86xx only have per-channel interrupts, right? (I'm not an 85xx/86xx guy, I've only got 83xx experience). This is what the device trees suggest, anyway. Right. It looks like the other problem is that the controller interrupt handler is assuming only one bit will be set in the summary register. It should call the channel handler for each bit that is set. Ok. I thought about doing this, but my changed approach seemed easier. On the 83xx, we should only need to call the per-channel handler once for each group of 8 bits. The original code used ffs(), which seems a little wrong. Why call the handler twice if both EOSI and EOCDI are set for a channel? Sorry, I meant call it once per channel that has bits set. Should I use a loop + mask, or is there some other neat trick I can use? After you process one channel, it shouldn't have any bits set (and if it does, it's a new event that needs to be processed), so you could use the current ffs approach with a while (summary reg != 0) loop around it. Ok. All of the in-tree 83xx device trees have 5 interrupts listed. With the changes described above, we'll only call request_irq() once in that case, and use the per-controller interrupt. I'll leave the documentation alone, with the exception of marking the per-controller interrupt optional. Hmm, that description is specific to 83xx, and such chips really should have the controller interrupt specified. The per-channel interrupt should not be optional, though. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] Fix spelling in comments and documentation
Replace platfrom -> platform. This is a frequent spelling bug. Signed-off-by: Stefan Weil --- Documentation/driver-model/platform.txt |2 +- arch/arm/mach-davinci/include/mach/i2c.h |2 +- arch/arm/mach-s3c2410/include/mach/spi-gpio.h |2 +- arch/arm/plat-s3c/include/plat/nand.h |2 +- arch/blackfin/include/asm/nand.h |4 ++-- arch/powerpc/kernel/legacy_serial.c |2 +- drivers/mtd/maps/plat-ram.c |2 +- drivers/net/cxgb3/sge.c |4 ++-- drivers/video/mbx/mbxfb.c |2 +- include/linux/dm9000.h|2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation/driver-model/platform.txt b/Documentation/driver-model/platform.txt index 2e2c2ea..41f4163 100644 --- a/Documentation/driver-model/platform.txt +++ b/Documentation/driver-model/platform.txt @@ -192,7 +192,7 @@ command line. This will execute all matching early_param() callbacks. User specified early platform devices will be registered at this point. For the early serial console case the user can specify port on the kernel command line as "earlyprintk=serial.0" where "earlyprintk" is -the class string, "serial" is the name of the platfrom driver and +the class string, "serial" is the name of the platform driver and 0 is the platform device id. If the id is -1 then the dot and the id can be omitted. diff --git a/arch/arm/mach-davinci/include/mach/i2c.h b/arch/arm/mach-davinci/include/mach/i2c.h index c248e9b..44bdea1 100644 --- a/arch/arm/mach-davinci/include/mach/i2c.h +++ b/arch/arm/mach-davinci/include/mach/i2c.h @@ -1,5 +1,5 @@ /* - * DaVinci I2C controller platfrom_device info + * DaVinci I2C controller platform_device info * * Author: Vladimir Barinov, MontaVista Software, Inc. * diff --git a/arch/arm/mach-s3c2410/include/mach/spi-gpio.h b/arch/arm/mach-s3c2410/include/mach/spi-gpio.h index 980a099..dcef228 100644 --- a/arch/arm/mach-s3c2410/include/mach/spi-gpio.h +++ b/arch/arm/mach-s3c2410/include/mach/spi-gpio.h @@ -3,7 +3,7 @@ * Copyright (c) 2006 Simtec Electronics * Ben Dooks * - * S3C2410 - SPI Controller platfrom_device info + * S3C2410 - SPI Controller platform_device info * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/arch/arm/plat-s3c/include/plat/nand.h b/arch/arm/plat-s3c/include/plat/nand.h index 226147b..b64115f 100644 --- a/arch/arm/plat-s3c/include/plat/nand.h +++ b/arch/arm/plat-s3c/include/plat/nand.h @@ -3,7 +3,7 @@ * Copyright (c) 2004 Simtec Electronics * Ben Dooks * - * S3C2410 - NAND device controller platfrom_device info + * S3C2410 - NAND device controller platform_device info * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as diff --git a/arch/blackfin/include/asm/nand.h b/arch/blackfin/include/asm/nand.h index 3ae8b56..3a1e79d 100644 --- a/arch/blackfin/include/asm/nand.h +++ b/arch/blackfin/include/asm/nand.h @@ -1,5 +1,5 @@ /* - * BF5XX - NAND flash controller platfrom_device info + * BF5XX - NAND flash controller platform_device info * * Copyright 2007-2008 Analog Devices, Inc. * @@ -8,7 +8,7 @@ /* struct bf5xx_nand_platform * - * define a interface between platfrom board specific code and + * define a interface between platform board specific code and * bf54x NFC driver. * * nr_partitions = number of partitions pointed to be partitoons (or zero) diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 9ddfaef..035ada5 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c @@ -469,7 +469,7 @@ static int __init serial_dev_init(void) return -ENODEV; /* -* Before we register the platfrom serial devices, we need +* Before we register the platform serial devices, we need * to fixup their interrupts and their IO ports. */ DBG("Fixing serial ports interrupts and IO ports ...\n"); diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index dafb919..76a76be 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c @@ -4,7 +4,7 @@ * http://www.simtec.co.uk/products/SWLINUX/ * Ben Dooks * - * Generic platfrom device based RAM map + * Generic platform device based RAM map * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index bdbd147..5dbc125 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c @@ -196,13 +196,13 @@ static inline void refill_rspq(struct adapter *adapter, /** * need_skb_unmap - does the platform ne
Re: [PATCH] Fix spelling in comments and documentation
On Thu, 7 Jan 2010 00:03:52 +0100 Stefan Weil wrote: > Replace platfrom -> platform. > > This is a frequent spelling bug. I have a "no spelling fixes unless they're in documentation or printks" policy ;) triv...@kernel.org would be a suitable recipient for this patch. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] Fix spelling in comments and documentation
On Wed, 6 Jan 2010, Andrew Morton wrote: > > Replace platfrom -> platform. > > > > This is a frequent spelling bug. > > I have a "no spelling fixes unless they're in documentation or printks" > policy ;) > > triv...@kernel.org would be a suitable recipient for this patch. Yup, I am usually applying all the comment typo fixes, as it makes the source more grepping-friendly. Applied, thanks Stefan. -- Jiri Kosina SUSE Labs, Novell Inc. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/8 v2] fsldma: cleanup driver and fix async_tx compatibility
This patch series cleans up the Freescale DMAEngine driver, including verifying the locking and making sure that all code paths are correct. There were a few places that seemed suspicious, and they have been fixed. I have written a quick memory->memory DMAEngine test driver, and the performance is identical before and after my changes (<0.1% change). I measured both setting up the DMA operation (via device_prep_dma_interrupt() and device_prep_dma_memcpy()) and the actual DMA transfer itself. As an added bonus, the interrupt load is measurably reduced. My test driver transfers 32MB as 32x 1MB chunks + 1 interrupt descriptor, using the functions noted above. Previous to this patch series, 31 interrupts were generated. After this patch series, only a single interrupt is generated for the whole transaction. Some testing on 85xx/86xx hardware would be appreciated. Also, some testing by the users attempting to use async_tx and talitos to handle RAID offload would be great as well. Documentation/powerpc/dts-bindings/fsl/dma.txt |8 + drivers/dma/fsldma.c | 1174 +--- drivers/dma/fsldma.h | 35 +- 3 files changed, 675 insertions(+), 542 deletions(-) v1 -> v2: - addresses comments from Scott Wood - prefer per-controller interrupt if available - rename "fchan" to "chan" - leave the documentation alone (mostly) Thanks, Ira ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 4/8] fsldma: rename dest to dst for uniformity
Most functions in the standard library use "dst" as a parameter, rather than "dest". This renames all use of "dest" to "dst" to match the usual convention. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 32 drivers/dma/fsldma.h |2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 6795d96..c2db754 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -90,14 +90,14 @@ static void set_desc_src(struct fsldma_chan *fsl_chan, hw->src_addr = CPU_TO_DMA(fsl_chan, snoop_bits | src, 64); } -static void set_desc_dest(struct fsldma_chan *fsl_chan, - struct fsl_dma_ld_hw *hw, dma_addr_t dest) +static void set_desc_dst(struct fsldma_chan *fsl_chan, + struct fsl_dma_ld_hw *hw, dma_addr_t dst) { u64 snoop_bits; snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) ? ((u64)FSL_DMA_DATR_DWRITETYPE_SNOOP_WRITE << 32) : 0; - hw->dst_addr = CPU_TO_DMA(fsl_chan, snoop_bits | dest, 64); + hw->dst_addr = CPU_TO_DMA(fsl_chan, snoop_bits | dst, 64); } static void set_desc_next(struct fsldma_chan *fsl_chan, @@ -253,7 +253,7 @@ static void fsl_chan_set_src_loop_size(struct fsldma_chan *fsl_chan, int size) } /** - * fsl_chan_set_dest_loop_size - Set destination address hold transfer size + * fsl_chan_set_dst_loop_size - Set destination address hold transfer size * @fsl_chan : Freescale DMA channel * @size : Address loop size, 0 for disable loop * @@ -263,7 +263,7 @@ static void fsl_chan_set_src_loop_size(struct fsldma_chan *fsl_chan, int size) * write data to TA, TA + 1, TA + 2, TA + 3, then loop back to TA, * TA + 1 ... and so on. */ -static void fsl_chan_set_dest_loop_size(struct fsldma_chan *fsl_chan, int size) +static void fsl_chan_set_dst_loop_size(struct fsldma_chan *fsl_chan, int size) { u32 mode; @@ -486,7 +486,7 @@ fsl_dma_prep_interrupt(struct dma_chan *chan, unsigned long flags) } static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( - struct dma_chan *chan, dma_addr_t dma_dest, dma_addr_t dma_src, + struct dma_chan *chan, dma_addr_t dma_dst, dma_addr_t dma_src, size_t len, unsigned long flags) { struct fsldma_chan *fsl_chan; @@ -519,7 +519,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( set_desc_cnt(fsl_chan, &new->hw, copy); set_desc_src(fsl_chan, &new->hw, dma_src); - set_desc_dest(fsl_chan, &new->hw, dma_dest); + set_desc_dst(fsl_chan, &new->hw, dma_dst); if (!first) first = new; @@ -532,7 +532,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_memcpy( prev = new; len -= copy; dma_src += copy; - dma_dest += copy; + dma_dst += copy; /* Insert the link descriptor to the LD ring */ list_add_tail(&new->node, &first->tx_list); @@ -680,7 +680,7 @@ static struct dma_async_tx_descriptor *fsl_dma_prep_slave_sg( /* Fill in the descriptor */ set_desc_cnt(fsl_chan, &new->hw, copy); set_desc_src(fsl_chan, &new->hw, dma_src); - set_desc_dest(fsl_chan, &new->hw, dma_dst); + set_desc_dst(fsl_chan, &new->hw, dma_dst); /* * If this is not the first descriptor, chain the @@ -721,8 +721,8 @@ finished: if (fsl_chan->set_src_loop_size) fsl_chan->set_src_loop_size(fsl_chan, slave->src_loop_size); - if (fsl_chan->set_dest_loop_size) - fsl_chan->set_dest_loop_size(fsl_chan, slave->dst_loop_size); + if (fsl_chan->set_dst_loop_size) + fsl_chan->set_dst_loop_size(fsl_chan, slave->dst_loop_size); if (fsl_chan->toggle_ext_start) fsl_chan->toggle_ext_start(fsl_chan, slave->external_start); @@ -867,7 +867,7 @@ static void fsl_chan_ld_cleanup(struct fsldma_chan *fsl_chan) static void fsl_chan_xfer_ld_queue(struct fsldma_chan *fsl_chan) { struct list_head *ld_node; - dma_addr_t next_dest_addr; + dma_addr_t next_dst_addr; unsigned long flags; spin_lock_irqsave(&fsl_chan->desc_lock, flags); @@ -892,10 +892,10 @@ static void fsl_chan_xfer_ld_queue(struct fsldma_chan *fsl_chan) if (ld_node != &fsl_chan->ld_queue) { /* Get the ld start address from ld_queue */ - next_dest_addr = to_fsl_desc(ld_node)->async_tx.phys; + next_dst_addr = to_fsl_desc(ld_node)->async_tx.phys; dev_dbg(fsl_chan->dev, "xfer LDs staring from 0x%llx\n", - (unsigned long long)next_dest_addr); - set_cdar(fsl_cha
[PATCH 1/8] fsldma: reduce kernel text size
Some of the functions are written in a way where they use multiple reads and writes where a single read/write pair could suffice. This shrinks the kernel text size measurably, while making the functions easier to understand. add/remove: 0/0 grow/shrink: 1/4 up/down: 4/-196 (-192) function old new delta fsl_chan_set_request_count 120 124 +4 dma_halt 300 272 -28 fsl_chan_set_src_loop_size 208 156 -52 fsl_chan_set_dest_loop_size 208 156 -52 fsl_chan_xfer_ld_queue 500 436 -64 Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 83 +++--- 1 files changed, 45 insertions(+), 38 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 296f9e7..0bad741 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -143,43 +143,45 @@ static int dma_is_idle(struct fsl_dma_chan *fsl_chan) static void dma_start(struct fsl_dma_chan *fsl_chan) { - u32 mr_set = 0; - - if (fsl_chan->feature & FSL_DMA_CHAN_PAUSE_EXT) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->bcr, 0, 32); - mr_set |= FSL_DMA_MR_EMP_EN; - } else if ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) - & ~FSL_DMA_MR_EMP_EN, 32); + u32 mode; + + mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + + if ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) { + if (fsl_chan->feature & FSL_DMA_CHAN_PAUSE_EXT) { + DMA_OUT(fsl_chan, &fsl_chan->reg_base->bcr, 0, 32); + mode |= FSL_DMA_MR_EMP_EN; + } else { + mode &= ~FSL_DMA_MR_EMP_EN; + } } if (fsl_chan->feature & FSL_DMA_CHAN_START_EXT) - mr_set |= FSL_DMA_MR_EMS_EN; + mode |= FSL_DMA_MR_EMS_EN; else - mr_set |= FSL_DMA_MR_CS; + mode |= FSL_DMA_MR_CS; - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) - | mr_set, 32); + DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); } static void dma_halt(struct fsl_dma_chan *fsl_chan) { + u32 mode; int i; - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) | FSL_DMA_MR_CA, - 32); - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & ~(FSL_DMA_MR_CS - | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA), 32); + mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + mode |= FSL_DMA_MR_CA; + DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); + + mode &= ~(FSL_DMA_MR_CS | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA); + DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); for (i = 0; i < 100; i++) { if (dma_is_idle(fsl_chan)) break; udelay(10); } + if (i >= 100 && !dma_is_idle(fsl_chan)) dev_err(fsl_chan->dev, "DMA halt timeout!\n"); } @@ -231,22 +233,23 @@ static void append_ld_queue(struct fsl_dma_chan *fsl_chan, */ static void fsl_chan_set_src_loop_size(struct fsl_dma_chan *fsl_chan, int size) { + u32 mode; + + mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + switch (size) { case 0: - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & - (~FSL_DMA_MR_SAHE), 32); + mode &= ~FSL_DMA_MR_SAHE; break; case 1: case 2: case 4: case 8: - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) | - FSL_DMA_MR_SAHE | (__ilog2(size) << 14), - 32); + mode |= FSL_DMA_MR_SAHE | (__ilog2(size) << 14); break; } + + DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); } /** @@ -262,22 +265,23 @@ static void fsl_chan_set_src_loop_size(struct fsl_dma_chan *fsl_chan, int size) */ static void fsl_chan_set_dest_loop_size(struct fsl_dma_chan *fsl_chan, int size) { + u32 mode; + + mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + switch (size) { case 0: - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, - DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) & - (~FSL_DMA_MR_DAHE), 32); +
[PATCH 2/8] fsldma: remove unused structure members
Remove some unused members from the fsldma data structures. A few trivial uses of struct resource were converted to use the stack rather than keeping the memory allocated for the lifetime of the driver. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 17 - drivers/dma/fsldma.h |4 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 0bad741..0b4e638 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -1072,6 +1072,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev, struct device_node *node, u32 feature, const char *compatible) { struct fsl_dma_chan *new_fsl_chan; + struct resource res; int err; /* alloc channel */ @@ -1083,7 +1084,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev, } /* get dma channel register base */ - err = of_address_to_resource(node, 0, &new_fsl_chan->reg); + err = of_address_to_resource(node, 0, &res); if (err) { dev_err(fdev->dev, "Can't get %s property 'reg'\n", node->full_name); @@ -1101,10 +1102,8 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev, WARN_ON(fdev->feature != new_fsl_chan->feature); new_fsl_chan->dev = fdev->dev; - new_fsl_chan->reg_base = ioremap(new_fsl_chan->reg.start, - new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1); - - new_fsl_chan->id = ((new_fsl_chan->reg.start - 0x100) & 0xfff) >> 7; + new_fsl_chan->reg_base = ioremap(res.start, resource_size(&res)); + new_fsl_chan->id = ((res.start - 0x100) & 0xfff) >> 7; if (new_fsl_chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) { dev_err(fdev->dev, "There is no %d channel!\n", new_fsl_chan->id); @@ -1183,6 +1182,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, int err; struct fsl_dma_device *fdev; struct device_node *child; + struct resource res; fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL); if (!fdev) { @@ -1193,7 +1193,7 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, INIT_LIST_HEAD(&fdev->common.channels); /* get DMA controller register base */ - err = of_address_to_resource(dev->node, 0, &fdev->reg); + err = of_address_to_resource(dev->node, 0, &res); if (err) { dev_err(&dev->dev, "Can't get %s property 'reg'\n", dev->node->full_name); @@ -1202,9 +1202,8 @@ static int __devinit of_fsl_dma_probe(struct of_device *dev, dev_info(&dev->dev, "Probe the Freescale DMA driver for %s " "controller at 0x%llx...\n", - match->compatible, (unsigned long long)fdev->reg.start); - fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end - - fdev->reg.start + 1); + match->compatible, (unsigned long long)res.start); + fdev->reg_base = ioremap(res.start, resource_size(&res)); dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask); dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask); diff --git a/drivers/dma/fsldma.h b/drivers/dma/fsldma.h index 0df14cb..dbb5b5c 100644 --- a/drivers/dma/fsldma.h +++ b/drivers/dma/fsldma.h @@ -92,8 +92,6 @@ struct fsl_desc_sw { struct list_head node; struct list_head tx_list; struct dma_async_tx_descriptor async_tx; - struct list_head *ld; - void *priv; } __attribute__((aligned(32))); struct fsl_dma_chan_regs { @@ -111,7 +109,6 @@ struct fsl_dma_chan; struct fsl_dma_device { void __iomem *reg_base; /* DGSR register base */ - struct resource reg;/* Resource for register */ struct device *dev; struct dma_device common; struct fsl_dma_chan *chan[FSL_DMA_MAX_CHANS_PER_DEVICE]; @@ -138,7 +135,6 @@ struct fsl_dma_chan { struct dma_chan common; /* DMA common channel */ struct dma_pool *desc_pool; /* Descriptors pool */ struct device *dev; /* Channel device */ - struct resource reg;/* Resource for register */ int irq;/* Channel IRQ */ int id; /* Raw id of this channel */ struct tasklet_struct tasklet; -- 1.5.4.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/8] fsldma: rename struct fsl_dma_chan to struct fsldma_chan
This is the beginning of a cleanup which will change all instances of "fsl_dma" to "fsldma" to match the name of the driver itself. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 128 ++--- drivers/dma/fsldma.h | 26 +- 2 files changed, 81 insertions(+), 73 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 0b4e638..6795d96 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -37,7 +37,7 @@ #include #include "fsldma.h" -static void dma_init(struct fsl_dma_chan *fsl_chan) +static void dma_init(struct fsldma_chan *fsl_chan) { /* Reset the channel */ DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, 0, 32); @@ -64,23 +64,23 @@ static void dma_init(struct fsl_dma_chan *fsl_chan) } -static void set_sr(struct fsl_dma_chan *fsl_chan, u32 val) +static void set_sr(struct fsldma_chan *fsl_chan, u32 val) { DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); } -static u32 get_sr(struct fsl_dma_chan *fsl_chan) +static u32 get_sr(struct fsldma_chan *fsl_chan) { return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); } -static void set_desc_cnt(struct fsl_dma_chan *fsl_chan, +static void set_desc_cnt(struct fsldma_chan *fsl_chan, struct fsl_dma_ld_hw *hw, u32 count) { hw->count = CPU_TO_DMA(fsl_chan, count, 32); } -static void set_desc_src(struct fsl_dma_chan *fsl_chan, +static void set_desc_src(struct fsldma_chan *fsl_chan, struct fsl_dma_ld_hw *hw, dma_addr_t src) { u64 snoop_bits; @@ -90,7 +90,7 @@ static void set_desc_src(struct fsl_dma_chan *fsl_chan, hw->src_addr = CPU_TO_DMA(fsl_chan, snoop_bits | src, 64); } -static void set_desc_dest(struct fsl_dma_chan *fsl_chan, +static void set_desc_dest(struct fsldma_chan *fsl_chan, struct fsl_dma_ld_hw *hw, dma_addr_t dest) { u64 snoop_bits; @@ -100,7 +100,7 @@ static void set_desc_dest(struct fsl_dma_chan *fsl_chan, hw->dst_addr = CPU_TO_DMA(fsl_chan, snoop_bits | dest, 64); } -static void set_desc_next(struct fsl_dma_chan *fsl_chan, +static void set_desc_next(struct fsldma_chan *fsl_chan, struct fsl_dma_ld_hw *hw, dma_addr_t next) { u64 snoop_bits; @@ -110,38 +110,38 @@ static void set_desc_next(struct fsl_dma_chan *fsl_chan, hw->next_ln_addr = CPU_TO_DMA(fsl_chan, snoop_bits | next, 64); } -static void set_cdar(struct fsl_dma_chan *fsl_chan, dma_addr_t addr) +static void set_cdar(struct fsldma_chan *fsl_chan, dma_addr_t addr) { DMA_OUT(fsl_chan, &fsl_chan->reg_base->cdar, addr | FSL_DMA_SNEN, 64); } -static dma_addr_t get_cdar(struct fsl_dma_chan *fsl_chan) +static dma_addr_t get_cdar(struct fsldma_chan *fsl_chan) { return DMA_IN(fsl_chan, &fsl_chan->reg_base->cdar, 64) & ~FSL_DMA_SNEN; } -static void set_ndar(struct fsl_dma_chan *fsl_chan, dma_addr_t addr) +static void set_ndar(struct fsldma_chan *fsl_chan, dma_addr_t addr) { DMA_OUT(fsl_chan, &fsl_chan->reg_base->ndar, addr, 64); } -static dma_addr_t get_ndar(struct fsl_dma_chan *fsl_chan) +static dma_addr_t get_ndar(struct fsldma_chan *fsl_chan) { return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); } -static u32 get_bcr(struct fsl_dma_chan *fsl_chan) +static u32 get_bcr(struct fsldma_chan *fsl_chan) { return DMA_IN(fsl_chan, &fsl_chan->reg_base->bcr, 32); } -static int dma_is_idle(struct fsl_dma_chan *fsl_chan) +static int dma_is_idle(struct fsldma_chan *fsl_chan) { u32 sr = get_sr(fsl_chan); return (!(sr & FSL_DMA_SR_CB)) || (sr & FSL_DMA_SR_CH); } -static void dma_start(struct fsl_dma_chan *fsl_chan) +static void dma_start(struct fsldma_chan *fsl_chan) { u32 mode; @@ -164,7 +164,7 @@ static void dma_start(struct fsl_dma_chan *fsl_chan) DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); } -static void dma_halt(struct fsl_dma_chan *fsl_chan) +static void dma_halt(struct fsldma_chan *fsl_chan) { u32 mode; int i; @@ -186,7 +186,7 @@ static void dma_halt(struct fsl_dma_chan *fsl_chan) dev_err(fsl_chan->dev, "DMA halt timeout!\n"); } -static void set_ld_eol(struct fsl_dma_chan *fsl_chan, +static void set_ld_eol(struct fsldma_chan *fsl_chan, struct fsl_desc_sw *desc) { u64 snoop_bits; @@ -199,7 +199,7 @@ static void set_ld_eol(struct fsl_dma_chan *fsl_chan, | snoop_bits, 64); } -static void append_ld_queue(struct fsl_dma_chan *fsl_chan, +static void append_ld_queue(struct fsldma_chan *fsl_chan, struct fsl_desc_sw *new_desc) { struct fsl_desc_sw *queue_tail = to_fsl_desc(fsl_chan->ld_queue.prev); @@ -231,7 +231,7 @@ static void append_ld_queue(struct fsl_dma_chan *fsl_chan, * read data from SA, SA + 1, SA + 2, SA + 3, then loop back to SA, * SA + 1 ... a
[PATCH 6/8] fsldma: simplify IRQ probing and handling
The IRQ probing is needlessly complex. All off the 83xx device trees in arch/powerpc/boot/dts/ specify 5 interrupts per DMA controller: one for the controller, and one for each channel. These interrupts are all attached to the same IRQ line. This causes an interesting situation if two channels interrupt at the same time. The per-controller handler will handle the first channel, and the per-channel handler will handle the remaining channels. Instead of this mess, we fix the bug in the per-controller handler, and make it handle all channels that generated an interrupt. When a per-controller handler is specified in the device tree, we prefer to use the shared handler instead of the per-channel handler. The 85xx/86xx controllers do not have a per-controller interrupt, and instead use a per-channel interrupt. This behavior has not been changed. Signed-off-by: Ira W. Snyder --- Documentation/powerpc/dts-bindings/fsl/dma.txt |8 + drivers/dma/fsldma.c | 173 ++-- 2 files changed, 137 insertions(+), 44 deletions(-) diff --git a/Documentation/powerpc/dts-bindings/fsl/dma.txt b/Documentation/powerpc/dts-bindings/fsl/dma.txt index 0732cdd..2a4b4bc 100644 --- a/Documentation/powerpc/dts-bindings/fsl/dma.txt +++ b/Documentation/powerpc/dts-bindings/fsl/dma.txt @@ -44,21 +44,29 @@ Example: compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; cell-index = <0>; reg = <0 0x80>; + interrupt-parent = <&ipic>; + interrupts = <71 8>; }; dma-chan...@80 { compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; cell-index = <1>; reg = <0x80 0x80>; + interrupt-parent = <&ipic>; + interrupts = <71 8>; }; dma-chan...@100 { compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; cell-index = <2>; reg = <0x100 0x80>; + interrupt-parent = <&ipic>; + interrupts = <71 8>; }; dma-chan...@180 { compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; cell-index = <3>; reg = <0x180 0x80>; + interrupt-parent = <&ipic>; + interrupts = <71 8>; }; }; diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 507b297..6a90592 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -967,6 +967,10 @@ static enum dma_status fsl_dma_is_complete(struct dma_chan *chan, return dma_async_is_complete(cookie, last_complete, last_used); } +/**/ +/* Interrupt Handling */ +/**/ + static irqreturn_t fsldma_chan_irq(int irq, void *data) { struct fsldma_chan *fsl_chan = data; @@ -1048,24 +1052,116 @@ static irqreturn_t fsldma_chan_irq(int irq, void *data) return IRQ_HANDLED; } -static irqreturn_t fsldma_irq(int irq, void *data) +static void dma_do_tasklet(unsigned long data) +{ + struct fsldma_chan *fsl_chan = (struct fsldma_chan *)data; + fsl_chan_ld_cleanup(fsl_chan); +} + +static irqreturn_t fsldma_ctrl_irq(int irq, void *data) { struct fsldma_device *fdev = data; - int ch_nr; - u32 gsr; + struct fsldma_chan *chan; + unsigned int handled = 0; + u32 gsr, mask; + int i; gsr = (fdev->feature & FSL_DMA_BIG_ENDIAN) ? in_be32(fdev->regs) - : in_le32(fdev->regs); - ch_nr = (32 - ffs(gsr)) / 8; + : in_le32(fdev->regs); + mask = 0xff00; + dev_dbg(fdev->dev, "IRQ: gsr 0x%.8x\n", gsr); - return fdev->chan[ch_nr] ? fsldma_chan_irq(irq, - fdev->chan[ch_nr]) : IRQ_NONE; + for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) { + chan = fdev->chan[i]; + if (!chan) + continue; + + if (gsr & mask) { + dev_dbg(fdev->dev, "IRQ: chan %d\n", chan->id); + fsldma_chan_irq(irq, chan); + handled++; + } + + gsr &= ~mask; + mask >>= 8; + } + + return IRQ_RETVAL(handled); } -static void dma_do_tasklet(unsigned long data) +static void fsldma_free_irqs(struct fsldma_device *fdev) { - struct fsldma_chan *fsl_chan = (struct fsldma_chan *)data; - fsl_chan_ld_cleanup(fsl_chan); + struc
[PATCH 5/8] fsldma: clean up the OF subsystem routines
This fixes some errors in the cleanup paths of the OF subsystem, including missing checks for ioremap failing. Also, some variables were renamed for brevity. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 259 + drivers/dma/fsldma.h |4 +- 2 files changed, 134 insertions(+), 129 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index c2db754..507b297 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -40,7 +40,7 @@ static void dma_init(struct fsldma_chan *fsl_chan) { /* Reset the channel */ - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, 0, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, 0, 32); switch (fsl_chan->feature & FSL_DMA_IP_MASK) { case FSL_DMA_IP_85XX: @@ -49,7 +49,7 @@ static void dma_init(struct fsldma_chan *fsl_chan) * EOSIE - End of segments interrupt enable (basic mode) * EOLNIE - End of links interrupt enable */ - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, FSL_DMA_MR_EIE + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, FSL_DMA_MR_EIE | FSL_DMA_MR_EOLNIE | FSL_DMA_MR_EOSIE, 32); break; case FSL_DMA_IP_83XX: @@ -57,7 +57,7 @@ static void dma_init(struct fsldma_chan *fsl_chan) * EOTIE - End-of-transfer interrupt enable * PRC_RM - PCI read multiple */ - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, FSL_DMA_MR_EOTIE + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, FSL_DMA_MR_EOTIE | FSL_DMA_MR_PRC_RM, 32); break; } @@ -66,12 +66,12 @@ static void dma_init(struct fsldma_chan *fsl_chan) static void set_sr(struct fsldma_chan *fsl_chan, u32 val) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->sr, val, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->sr, val, 32); } static u32 get_sr(struct fsldma_chan *fsl_chan) { - return DMA_IN(fsl_chan, &fsl_chan->reg_base->sr, 32); + return DMA_IN(fsl_chan, &fsl_chan->regs->sr, 32); } static void set_desc_cnt(struct fsldma_chan *fsl_chan, @@ -112,27 +112,27 @@ static void set_desc_next(struct fsldma_chan *fsl_chan, static void set_cdar(struct fsldma_chan *fsl_chan, dma_addr_t addr) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->cdar, addr | FSL_DMA_SNEN, 64); + DMA_OUT(fsl_chan, &fsl_chan->regs->cdar, addr | FSL_DMA_SNEN, 64); } static dma_addr_t get_cdar(struct fsldma_chan *fsl_chan) { - return DMA_IN(fsl_chan, &fsl_chan->reg_base->cdar, 64) & ~FSL_DMA_SNEN; + return DMA_IN(fsl_chan, &fsl_chan->regs->cdar, 64) & ~FSL_DMA_SNEN; } static void set_ndar(struct fsldma_chan *fsl_chan, dma_addr_t addr) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->ndar, addr, 64); + DMA_OUT(fsl_chan, &fsl_chan->regs->ndar, addr, 64); } static dma_addr_t get_ndar(struct fsldma_chan *fsl_chan) { - return DMA_IN(fsl_chan, &fsl_chan->reg_base->ndar, 64); + return DMA_IN(fsl_chan, &fsl_chan->regs->ndar, 64); } static u32 get_bcr(struct fsldma_chan *fsl_chan) { - return DMA_IN(fsl_chan, &fsl_chan->reg_base->bcr, 32); + return DMA_IN(fsl_chan, &fsl_chan->regs->bcr, 32); } static int dma_is_idle(struct fsldma_chan *fsl_chan) @@ -145,11 +145,11 @@ static void dma_start(struct fsldma_chan *fsl_chan) { u32 mode; - mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + mode = DMA_IN(fsl_chan, &fsl_chan->regs->mr, 32); if ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) { if (fsl_chan->feature & FSL_DMA_CHAN_PAUSE_EXT) { - DMA_OUT(fsl_chan, &fsl_chan->reg_base->bcr, 0, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->bcr, 0, 32); mode |= FSL_DMA_MR_EMP_EN; } else { mode &= ~FSL_DMA_MR_EMP_EN; @@ -161,7 +161,7 @@ static void dma_start(struct fsldma_chan *fsl_chan) else mode |= FSL_DMA_MR_CS; - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, mode, 32); } static void dma_halt(struct fsldma_chan *fsl_chan) @@ -169,12 +169,12 @@ static void dma_halt(struct fsldma_chan *fsl_chan) u32 mode; int i; - mode = DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32); + mode = DMA_IN(fsl_chan, &fsl_chan->regs->mr, 32); mode |= FSL_DMA_MR_CA; - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, mode, 32); mode &= ~(FSL_DMA_MR_CS | FSL_DMA_MR_EMS_EN | FSL_DMA_MR_CA); - DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr, mode, 32); + DMA_OUT(fsl_chan, &fsl_chan->regs->mr, mode, 32); for (i = 0; i < 100; i++) { if (dma_is_idle(fsl_chan)) @@ -235,7 +235,7 @@ static v
[PATCH 8/8] fsldma: major cleanups and fixes
Fix locking. Use two queues in the driver, one for pending transacions, and one for transactions which are actually running on the hardware. Call dma_run_dependencies() on descriptor cleanup so that the async_tx API works correctly. There are a number of places throughout the code where lists of descriptors are freed in a loop. Create functions to handle this, and use them instead of open-coding the loop each time. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 386 ++--- drivers/dma/fsldma.h |3 +- 2 files changed, 207 insertions(+), 182 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 7b5f88c..19011c2 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -61,7 +61,6 @@ static void dma_init(struct fsldma_chan *chan) | FSL_DMA_MR_PRC_RM, 32); break; } - } static void set_sr(struct fsldma_chan *chan, u32 val) @@ -120,11 +119,6 @@ static dma_addr_t get_cdar(struct fsldma_chan *chan) return DMA_IN(chan, &chan->regs->cdar, 64) & ~FSL_DMA_SNEN; } -static void set_ndar(struct fsldma_chan *chan, dma_addr_t addr) -{ - DMA_OUT(chan, &chan->regs->ndar, addr, 64); -} - static dma_addr_t get_ndar(struct fsldma_chan *chan) { return DMA_IN(chan, &chan->regs->ndar, 64); @@ -178,11 +172,12 @@ static void dma_halt(struct fsldma_chan *chan) for (i = 0; i < 100; i++) { if (dma_is_idle(chan)) - break; + return; + udelay(10); } - if (i >= 100 && !dma_is_idle(chan)) + if (!dma_is_idle(chan)) dev_err(chan->dev, "DMA halt timeout!\n"); } @@ -199,27 +194,6 @@ static void set_ld_eol(struct fsldma_chan *chan, | snoop_bits, 64); } -static void append_ld_queue(struct fsldma_chan *chan, - struct fsl_desc_sw *new_desc) -{ - struct fsl_desc_sw *queue_tail = to_fsl_desc(chan->ld_queue.prev); - - if (list_empty(&chan->ld_queue)) - return; - - /* Link to the new descriptor physical address and -* Enable End-of-segment interrupt for -* the last link descriptor. -* (the previous node's next link descriptor) -* -* For FSL_DMA_IP_83xx, the snoop enable bit need be set. -*/ - queue_tail->hw.next_ln_addr = CPU_TO_DMA(chan, - new_desc->async_tx.phys | FSL_DMA_EOSIE | - (((chan->feature & FSL_DMA_IP_MASK) - == FSL_DMA_IP_83XX) ? FSL_DMA_SNEN : 0), 64); -} - /** * fsl_chan_set_src_loop_size - Set source address hold transfer size * @chan : Freescale DMA channel @@ -343,6 +317,31 @@ static void fsl_chan_toggle_ext_start(struct fsldma_chan *chan, int enable) chan->feature &= ~FSL_DMA_CHAN_START_EXT; } +static void append_ld_queue(struct fsldma_chan *chan, + struct fsl_desc_sw *desc) +{ + struct fsl_desc_sw *tail = to_fsl_desc(chan->ld_pending.prev); + + if (list_empty(&chan->ld_pending)) + goto out_splice; + + /* +* Add the hardware descriptor to the chain of hardware descriptors +* that already exists in memory. +* +* This will un-set the EOL bit of the existing transaction, and the +* last link in this transaction will become the EOL descriptor. +*/ + set_desc_next(chan, &tail->hw, desc->async_tx.phys); + + /* +* Add the software descriptor and all children to the list +* of pending transactions +*/ +out_splice: + list_splice_tail_init(&desc->tx_list, &chan->ld_pending); +} + static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) { struct fsldma_chan *chan = to_fsl_chan(tx->chan); @@ -351,9 +350,12 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) unsigned long flags; dma_cookie_t cookie; - /* cookie increment and adding to ld_queue must be atomic */ spin_lock_irqsave(&chan->desc_lock, flags); + /* +* assign cookies to all of the software descriptors +* that make up this transaction +*/ cookie = chan->common.cookie; list_for_each_entry(child, &desc->tx_list, node) { cookie++; @@ -364,8 +366,9 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) } chan->common.cookie = cookie; + + /* put this transaction onto the tail of the pending queue */ append_ld_queue(chan, desc); - list_splice_init(&desc->tx_list, chan->ld_queue.prev); spin_unlock_irqrestore(&chan->desc_lock, flags); @@ -381,20 +384,22 @@ static dma_cookie_t fsl_dma_tx_submit(struct dma_async_tx_descriptor *tx) static struct fsl_desc_sw *fsl_dma_alloc_descriptor(
[PATCH 7/8] fsldma: rename fsl_chan to chan
The name fsl_chan seems too long, so it has been shortened to chan. There are only a few places where the higher level "struct dma_chan *chan" name conflicts. These have been changed to "struct dma_chan *dchan" instead. Signed-off-by: Ira W. Snyder --- drivers/dma/fsldma.c | 550 +- 1 files changed, 275 insertions(+), 275 deletions(-) diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c index 6a90592..7b5f88c 100644 --- a/drivers/dma/fsldma.c +++ b/drivers/dma/fsldma.c @@ -37,19 +37,19 @@ #include #include "fsldma.h" -static void dma_init(struct fsldma_chan *fsl_chan) +static void dma_init(struct fsldma_chan *chan) { /* Reset the channel */ - DMA_OUT(fsl_chan, &fsl_chan->regs->mr, 0, 32); + DMA_OUT(chan, &chan->regs->mr, 0, 32); - switch (fsl_chan->feature & FSL_DMA_IP_MASK) { + switch (chan->feature & FSL_DMA_IP_MASK) { case FSL_DMA_IP_85XX: /* Set the channel to below modes: * EIE - Error interrupt enable * EOSIE - End of segments interrupt enable (basic mode) * EOLNIE - End of links interrupt enable */ - DMA_OUT(fsl_chan, &fsl_chan->regs->mr, FSL_DMA_MR_EIE + DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_EIE | FSL_DMA_MR_EOLNIE | FSL_DMA_MR_EOSIE, 32); break; case FSL_DMA_IP_83XX: @@ -57,154 +57,154 @@ static void dma_init(struct fsldma_chan *fsl_chan) * EOTIE - End-of-transfer interrupt enable * PRC_RM - PCI read multiple */ - DMA_OUT(fsl_chan, &fsl_chan->regs->mr, FSL_DMA_MR_EOTIE + DMA_OUT(chan, &chan->regs->mr, FSL_DMA_MR_EOTIE | FSL_DMA_MR_PRC_RM, 32); break; } } -static void set_sr(struct fsldma_chan *fsl_chan, u32 val) +static void set_sr(struct fsldma_chan *chan, u32 val) { - DMA_OUT(fsl_chan, &fsl_chan->regs->sr, val, 32); + DMA_OUT(chan, &chan->regs->sr, val, 32); } -static u32 get_sr(struct fsldma_chan *fsl_chan) +static u32 get_sr(struct fsldma_chan *chan) { - return DMA_IN(fsl_chan, &fsl_chan->regs->sr, 32); + return DMA_IN(chan, &chan->regs->sr, 32); } -static void set_desc_cnt(struct fsldma_chan *fsl_chan, +static void set_desc_cnt(struct fsldma_chan *chan, struct fsl_dma_ld_hw *hw, u32 count) { - hw->count = CPU_TO_DMA(fsl_chan, count, 32); + hw->count = CPU_TO_DMA(chan, count, 32); } -static void set_desc_src(struct fsldma_chan *fsl_chan, +static void set_desc_src(struct fsldma_chan *chan, struct fsl_dma_ld_hw *hw, dma_addr_t src) { u64 snoop_bits; - snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) + snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) ? ((u64)FSL_DMA_SATR_SREADTYPE_SNOOP_READ << 32) : 0; - hw->src_addr = CPU_TO_DMA(fsl_chan, snoop_bits | src, 64); + hw->src_addr = CPU_TO_DMA(chan, snoop_bits | src, 64); } -static void set_desc_dst(struct fsldma_chan *fsl_chan, +static void set_desc_dst(struct fsldma_chan *chan, struct fsl_dma_ld_hw *hw, dma_addr_t dst) { u64 snoop_bits; - snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) + snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_85XX) ? ((u64)FSL_DMA_DATR_DWRITETYPE_SNOOP_WRITE << 32) : 0; - hw->dst_addr = CPU_TO_DMA(fsl_chan, snoop_bits | dst, 64); + hw->dst_addr = CPU_TO_DMA(chan, snoop_bits | dst, 64); } -static void set_desc_next(struct fsldma_chan *fsl_chan, +static void set_desc_next(struct fsldma_chan *chan, struct fsl_dma_ld_hw *hw, dma_addr_t next) { u64 snoop_bits; - snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_83XX) + snoop_bits = ((chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_83XX) ? FSL_DMA_SNEN : 0; - hw->next_ln_addr = CPU_TO_DMA(fsl_chan, snoop_bits | next, 64); + hw->next_ln_addr = CPU_TO_DMA(chan, snoop_bits | next, 64); } -static void set_cdar(struct fsldma_chan *fsl_chan, dma_addr_t addr) +static void set_cdar(struct fsldma_chan *chan, dma_addr_t addr) { - DMA_OUT(fsl_chan, &fsl_chan->regs->cdar, addr | FSL_DMA_SNEN, 64); + DMA_OUT(chan, &chan->regs->cdar, addr | FSL_DMA_SNEN, 64); } -static dma_addr_t get_cdar(struct fsldma_chan *fsl_chan) +static dma_addr_t get_cdar(struct fsldma_chan *chan) { - return DMA_IN(fsl_chan, &fsl_chan->regs->cdar, 64) & ~FSL_DMA_SNEN; + return DMA_IN(chan, &chan->regs->cdar, 64) & ~FSL_DMA_SNEN; } -static void set_ndar(struct fsldma_chan *fsl_chan, dma_addr_t addr) +static void set_ndar(struct fsldma_chan *chan, dma_add
[PATCH] nodmask.h: remove macro any_online_node
nodmask.h: remove macro any_online_node The macro any_online_node is prone to producing sparse warnings due to the local symbol 'node'. Since all the in-tree users are really requesting the first online node (the mask argument is either NODE_MASK_ALL or node_online_map) just use the first_online_node macro and remove the any_online_node macro since there are no users. Signed-off-by: H Hartley Sweeten Cc: Andrew Morton Cc: David Rientjes Cc: KAMEZAWA Hiroyuki Cc: Mel Gorman Cc: Lee Schermerhorn Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Dave Hansen Cc: Milton Miller Cc: Nathan Fontenot Cc: Geoff Levand Cc: Grant Likely Cc: J. Bruce Fields Cc: Neil Brown Cc: Trond Myklebust Cc: David S. Miller Cc: Benny Halevy Cc: Chuck Lever Cc: Ricardo Labiaga --- diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index b037d95..64c0022 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c @@ -451,7 +451,7 @@ static int __cpuinit numa_setup_cpu(unsigned long lcpu) nid = of_node_to_nid_single(cpu); if (nid < 0 || !node_online(nid)) - nid = any_online_node(NODE_MASK_ALL); + nid = first_online_node; out: map_cpu_to_node(lcpu, nid); @@ -1114,7 +1114,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr) int nid, found = 0; if (!numa_enabled || (min_common_depth < 0)) - return any_online_node(NODE_MASK_ALL); + return first_online_node; memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); if (memory) { @@ -1125,7 +1125,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr) } if (nid < 0 || !node_online(nid)) - nid = any_online_node(NODE_MASK_ALL); + nid = first_online_node; if (NODE_DATA(nid)->node_spanned_pages) return nid; diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 454997c..c4fa64b 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h @@ -69,8 +69,6 @@ * int node_online(node) Is some node online? * int node_possible(node) Is some node possible? * - * int any_online_node(mask) First online node in mask - * * node_set_online(node) set bit 'node' in node_online_map * node_set_offline(node) clear bit 'node' in node_online_map * @@ -467,15 +465,6 @@ static inline int num_node_state(enum node_states state) #define node_online_mapnode_states[N_ONLINE] #define node_possible_map node_states[N_POSSIBLE] -#define any_online_node(mask) \ -({ \ - int node; \ - for_each_node_mask(node, (mask))\ - if (node_online(node)) \ - break; \ - node; \ -}) - #define num_online_nodes() num_node_state(N_ONLINE) #define num_possible_nodes() num_node_state(N_POSSIBLE) #define node_online(node) node_state((node), N_ONLINE) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 538ca43..832c1fe 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -133,7 +133,7 @@ svc_pool_map_choose_mode(void) return SVC_POOL_PERNODE; } - node = any_online_node(node_online_map); + node = first_online_node; if (nr_cpus_node(node) > 2) { /* * Non-trivial SMP, or CONFIG_NUMA on ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] nodmask.h: remove macro any_online_node
On Wed, 6 Jan 2010, H Hartley Sweeten wrote: > nodmask.h: remove macro any_online_node > > The macro any_online_node is prone to producing sparse warnings > due to the local symbol 'node'. Since all the in-tree users are really > requesting the first online node (the mask argument is either > NODE_MASK_ALL or node_online_map) just use the first_online_node > macro and remove the any_online_node macro since there are no users. > > Signed-off-by: H Hartley Sweeten > Cc: Andrew Morton > Cc: David Rientjes > Cc: KAMEZAWA Hiroyuki > Cc: Mel Gorman > Cc: Lee Schermerhorn > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Dave Hansen > Cc: Milton Miller > Cc: Nathan Fontenot > Cc: Geoff Levand > Cc: Grant Likely > Cc: J. Bruce Fields > Cc: Neil Brown > Cc: Trond Myklebust > Cc: David S. Miller > Cc: Benny Halevy > Cc: Chuck Lever > Cc: Ricardo Labiaga Acked-by: David Rientjes ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] nodmask.h: remove macro any_online_node
On Wed, 6 Jan 2010 16:24:58 -0700 H Hartley Sweeten wrote: > nodmask.h: remove macro any_online_node > > The macro any_online_node is prone to producing sparse warnings > due to the local symbol 'node'. Since all the in-tree users are really > requesting the first online node (the mask argument is either > NODE_MASK_ALL or node_online_map) just use the first_online_node > macro and remove the any_online_node macro since there are no users. > Reviewed-by: KAMEZAWA Hiroyuki Thank you. BTW, it's better to add diffstat to this kind of changes. Regards, -Kame > Signed-off-by: H Hartley Sweeten > Cc: Andrew Morton > Cc: David Rientjes > Cc: KAMEZAWA Hiroyuki > Cc: Mel Gorman > Cc: Lee Schermerhorn > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Dave Hansen > Cc: Milton Miller > Cc: Nathan Fontenot > Cc: Geoff Levand > Cc: Grant Likely > Cc: J. Bruce Fields > Cc: Neil Brown > Cc: Trond Myklebust > Cc: David S. Miller > Cc: Benny Halevy > Cc: Chuck Lever > Cc: Ricardo Labiaga > > --- > > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c > index b037d95..64c0022 100644 > --- a/arch/powerpc/mm/numa.c > +++ b/arch/powerpc/mm/numa.c > @@ -451,7 +451,7 @@ static int __cpuinit numa_setup_cpu(unsigned long lcpu) > nid = of_node_to_nid_single(cpu); > > if (nid < 0 || !node_online(nid)) > - nid = any_online_node(NODE_MASK_ALL); > + nid = first_online_node; > out: > map_cpu_to_node(lcpu, nid); > > @@ -1114,7 +1114,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr) > int nid, found = 0; > > if (!numa_enabled || (min_common_depth < 0)) > - return any_online_node(NODE_MASK_ALL); > + return first_online_node; > > memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory"); > if (memory) { > @@ -1125,7 +1125,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr) > } > > if (nid < 0 || !node_online(nid)) > - nid = any_online_node(NODE_MASK_ALL); > + nid = first_online_node; > > if (NODE_DATA(nid)->node_spanned_pages) > return nid; > diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h > index 454997c..c4fa64b 100644 > --- a/include/linux/nodemask.h > +++ b/include/linux/nodemask.h > @@ -69,8 +69,6 @@ > * int node_online(node) Is some node online? > * int node_possible(node) Is some node possible? > * > - * int any_online_node(mask) First online node in mask > - * > * node_set_online(node) set bit 'node' in node_online_map > * node_set_offline(node)clear bit 'node' in node_online_map > * > @@ -467,15 +465,6 @@ static inline int num_node_state(enum node_states state) > #define node_online_map node_states[N_ONLINE] > #define node_possible_mapnode_states[N_POSSIBLE] > > -#define any_online_node(mask)\ > -({ \ > - int node; \ > - for_each_node_mask(node, (mask))\ > - if (node_online(node)) \ > - break; \ > - node; \ > -}) > - > #define num_online_nodes() num_node_state(N_ONLINE) > #define num_possible_nodes() num_node_state(N_POSSIBLE) > #define node_online(node)node_state((node), N_ONLINE) > diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c > index 538ca43..832c1fe 100644 > --- a/net/sunrpc/svc.c > +++ b/net/sunrpc/svc.c > @@ -133,7 +133,7 @@ svc_pool_map_choose_mode(void) > return SVC_POOL_PERNODE; > } > > - node = any_online_node(node_online_map); > + node = first_online_node; > if (nr_cpus_node(node) > 2) { > /* >* Non-trivial SMP, or CONFIG_NUMA on > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] proc_devtree: fix THIS_MODULE without module.h
Commit e22f628395432b967f2f505858c64450f7835365 introduced a build breakage for ARM devtree work: the THIS_MODULE macro was added, but we don't have module.h This change adds the necessary #include to get THIS_MODULE defined. While we could just replace it with NULL (PROC_FS is a bool, not a tristate), using THIS_MODULE will prevent unexpected breakage if we ever do compile this as a module. Signed-off-by: Jeremy Kerr --- fs/proc/proc_devtree.c |1 + 1 file changed, 1 insertion(+) diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index 0ec4511..f8650dc 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include "internal.h" ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: i2c_powermac: Kernel access of bad area
Hi Jean, On Wed, 6 Jan 2010 at 17:37, Jean Delvare wrote: > I think that sysfs files creation should be moved to the end of > probe_thermostat() and sysfs files removal should be moved to the > beginning of remove_thermostat(). Something like the totally untested > patch below (no ppc machine at hand): I applied your patch to 2.6.33-rc3, and was able to unload i2c-powermac and then reading the files left in /sys/devices/temperatures. I even tried to read the non-existant files (e.g. sensor1_fan_speed, etc...), but the kernel just wouldn't oops :) So the initial oops is gone - yeah! However, the "Badness" remains when I try to modprobe i2c-powermac again: [ 442.148222] PowerMac i2c bus pmu 2 registered [ 442.148792] PowerMac i2c bus pmu 1 registered [ 442.149299] PowerMac i2c bus mac-io 0 registered [ 442.163573] adt746x: ADT7467 initializing [ 442.170072] adt746x: Lowering max temperatures from 73, 80, 109 to 67, 47, 67 [ 442.176559] PowerMac i2c bus uni-n 1 registered [ 442.227115] sysfs: cannot create duplicate filename '/devices/ams' [ 442.227697] [ cut here ] [ 442.228176] Badness at fs/sysfs/dir.c:487 [ 442.228642] NIP: c00eb71c LR: c00eb71c CTR: [ 442.229117] REGS: eea0fa50 TRAP: 0700 Not tainted (2.6.33-rc3) [ 442.229592] MSR: 00029032 CR: 42008444 XER: [ 442.230151] TASK = eea1[2821] 'modprobe' THREAD: eea0e000 [ 442.230191] GPR00: c00eb71c eea0fb00 eea1 004c 64c6 [ 442.230758] GPR08: efa71740 c03e 64c6 44008428 10020390 100e 100df49c [ 442.231326] GPR16: 100b54c0 100df49c 100ddd20 1018fb08 100b5340 c03e674c c03e6720 c03ea044 [ 442.231902] GPR24: 24008422 ffea eea0fb58 ef0e9000 ef0e9000 ef0a9ea0 ffef [ 442.233187] NIP [c00eb71c] sysfs_add_one+0x94/0xc0 [ 442.233695] LR [c00eb71c] sysfs_add_one+0x94/0xc0 [ 442.234363] Call Trace: I've put the whole dmesg on: http://nerdbynature.de/bits/2.6.33-rc2/i2c_powermac/r1/ Thanks for your time, Christian. -- BOFH excuse #168: le0: no carrier: transceiver cable problem? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev