All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] tcp: split tcp_ecn sysctl knob to distinguish between IPv4 and IPv6
From: Stephen Hemminger @ 2012-12-31 22:04 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: netdev
In-Reply-To: <20121231173532.GA11700@order.stressinduktion.org>

On Mon, 31 Dec 2012 18:35:33 +0100
Hannes Frederic Sowa <hannes@stressinduktion.org> wrote:

> diff --git a/include/net/sock.h b/include/net/sock.h
> index 182ca99..aa3c30e 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -944,6 +944,7 @@ struct proto {
>  	int			*sysctl_rmem;
>  	int			max_header;
>  	bool			no_autobind;
> +	int			ecn;
>  
Why isn't this a bool?

^ permalink raw reply

* RE: [PATCH] serial: samsung: remove redundant setting of line config during port reset
From: Kukjin Kim @ 2012-12-31 22:03 UTC (permalink / raw)
  To: 'Thomas Abraham', linux-serial; +Cc: gregkh, alan, linux-samsung-soc
In-Reply-To: <1356990165-3905-1-git-send-email-thomas.ab@samsung.com>

Thomas Abraham wrote:
> 
> The setting of uart line control configuration in s3c24xx_serial_resetport
> is can be removed since the 'set_termios' call will overwrite any ULCON
> register setting which s3c24xx_serial_resetport does.
> 
> Cc: Kukjin Kim <kgene.kim@samsung.com>

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Greg, if you're ok on this, please pick this up for v3.8

Happy New Year!!!

- Kukjin

> Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
> ---
>  drivers/tty/serial/samsung.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
> index 12e5249..e514b3a 100644
> --- a/drivers/tty/serial/samsung.c
> +++ b/drivers/tty/serial/samsung.c
> @@ -1006,7 +1006,6 @@ static void s3c24xx_serial_resetport(struct
> uart_port *port,
> 
>  	ucon &= ucon_mask;
>  	wr_regl(port, S3C2410_UCON,  ucon | cfg->ucon);
> -	wr_regl(port, S3C2410_ULCON, cfg->ulcon);
> 
>  	/* reset both fifos */
>  	wr_regl(port, S3C2410_UFCON, cfg->ufcon |
> S3C2410_UFCON_RESETBOTH);
> --
> 1.7.5.4

^ permalink raw reply

* [PATCH] vxlan: allow live mac address change
From: Stephen Hemminger @ 2012-12-31 22:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

The VXLAN pseudo-device doesn't care if the mac address changes
when device is up.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/vxlan.c	2012-12-27 22:30:53.630796042 -0800
+++ b/drivers/net/vxlan.c	2012-12-31 10:46:25.435321912 -0800
@@ -1191,6 +1191,7 @@ static void vxlan_setup(struct net_devic
 
 	dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
 	dev->priv_flags	&= ~IFF_XMIT_DST_RELEASE;
+	dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
 
 	spin_lock_init(&vxlan->hash_lock);
 

^ permalink raw reply

* Re: [RFC][PATCH 8/9 v1] ext4: refine unwritten extent conversion
From: Jan Kara @ 2012-12-31 21:58 UTC (permalink / raw)
  To: Zheng Liu
  Cc: linux-ext4, Jan Kara, Darrick J. Wong, Christoph Hellwig,
	Zheng Liu
In-Reply-To: <1356335742-11793-9-git-send-email-wenqing.lz@taobao.com>

On Mon 24-12-12 15:55:41, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> Currently all unwritten extent conversion work is pushed into a workqueue to be
> done because DIO end_io is in a irq context and this conversion needs to take
> i_data_sem locking.  But we couldn't take a semaphore in a irq context.  After
> tracking all extent status, we can first convert this unwritten extent in extent
> status tree, and call aio_complete() and inode_dio_done() to notify upper level
> that this dio has done.  We don't need to be worried about exposing a stale data
> because we first try to lookup in extent status tree.  So it makes us to see the
> latest extent status.  Meanwhile we queue a work to convert this unwritten
> extent in extent tree.  After this improvement, reader also needn't wait this
> conversion to be done when dioread_nolock is enabled.
> 
> CC: Jan Kara <jack@suse.cz>
> CC: "Darrick J. Wong" <darrick.wong@oracle.com>
> CC: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
  OK, so after reading other patches this should work fine. Just I think we
should somehow mark in the extent status tree that the extent tree is
inconsistent with what's on disk - something like extent dirty bit. It will
be set for UNWRITTEN extents where conversion is pending logically it would
also make sence to have it set for DELAYED extents. Then if we need to
reclaim some extents due to memory pressure we know we have to keep dirty
extents because those cache irreplacible information. What do you think?

								Honza
> 
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 8462eb3..b76dc49 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -195,7 +195,6 @@ struct mpage_da_data {
>  #define	EXT4_IO_END_UNWRITTEN	0x0001
>  #define EXT4_IO_END_ERROR	0x0002
>  #define EXT4_IO_END_QUEUED	0x0004
> -#define EXT4_IO_END_DIRECT	0x0008
>  
>  struct ext4_io_page {
>  	struct page	*p_page;
> @@ -2538,6 +2537,7 @@ extern void ext4_ioend_wait(struct inode *);
>  extern void ext4_free_io_end(ext4_io_end_t *io);
>  extern ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags);
>  extern void ext4_io_submit(struct ext4_io_submit *io);
> +extern void ext4_end_io_bh(ext4_io_end_t *io_end, int is_dio);
>  extern int ext4_bio_write_page(struct ext4_io_submit *io,
>  			       struct page *page,
>  			       int len,
> diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
> index 20862f9..c6d7f7f 100644
> --- a/fs/ext4/indirect.c
> +++ b/fs/ext4/indirect.c
> @@ -807,11 +807,6 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,
>  
>  retry:
>  	if (rw == READ && ext4_should_dioread_nolock(inode)) {
> -		if (unlikely(atomic_read(&EXT4_I(inode)->i_unwritten))) {
> -			mutex_lock(&inode->i_mutex);
> -			ext4_flush_unwritten_io(inode);
> -			mutex_unlock(&inode->i_mutex);
> -		}
>  		/*
>  		 * Nolock dioread optimization may be dynamically disabled
>  		 * via ext4_inode_block_unlocked_dio(). Check inode's state
> @@ -831,8 +826,10 @@ retry:
>  		inode_dio_done(inode);
>  	} else {
>  locked:
> -		ret = blockdev_direct_IO(rw, iocb, inode, iov,
> -				 offset, nr_segs, ext4_get_block);
> +		ret = __blockdev_direct_IO(rw, iocb, inode,
> +				 inode->i_sb->s_bdev, iov,
> +				 offset, nr_segs,
> +				 ext4_get_block, NULL, NULL, DIO_LOCKING);
>  
>  		if (unlikely((rw & WRITE) && ret < 0)) {
>  			loff_t isize = i_size_read(inode);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 6610dc7..4549103 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3024,9 +3024,8 @@ static int ext4_get_block_write_nolock(struct inode *inode, sector_t iblock,
>  			       EXT4_GET_BLOCKS_NO_LOCK);
>  }
>  
> -static void ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
> -			    ssize_t size, void *private, int ret,
> -			    bool is_async)
> +static void ext4_end_dio(struct kiocb *iocb, loff_t offset, ssize_t size,
> +			 void *private, int ret, bool is_async)
>  {
>  	struct inode *inode = iocb->ki_filp->f_path.dentry->d_inode;
>          ext4_io_end_t *io_end = iocb->private;
> @@ -3058,8 +3057,7 @@ out:
>  		io_end->iocb = iocb;
>  		io_end->result = ret;
>  	}
> -
> -	ext4_add_complete_io(io_end);
> +	ext4_end_io_bh(io_end, 1);
>  }
>  
>  static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate)
> @@ -3195,7 +3193,6 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
>  			ret = -ENOMEM;
>  			goto retake_lock;
>  		}
> -		io_end->flag |= EXT4_IO_END_DIRECT;
>  		iocb->private = io_end;
>  		/*
>  		 * we save the io structure for current async direct
> @@ -3216,7 +3213,7 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb,
>  				   inode->i_sb->s_bdev, iov,
>  				   offset, nr_segs,
>  				   get_block_func,
> -				   ext4_end_io_dio,
> +				   ext4_end_dio,
>  				   NULL,
>  				   dio_flags);
>  
> diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
> index 0016fbc..6b2d88d 100644
> --- a/fs/ext4/page-io.c
> +++ b/fs/ext4/page-io.c
> @@ -103,17 +103,35 @@ static int ext4_end_io(ext4_io_end_t *io)
>  			 "(inode %lu, offset %llu, size %zd, error %d)",
>  			 inode->i_ino, offset, size, ret);
>  	}
> -	if (io->iocb)
> -		aio_complete(io->iocb, io->result, 0);
>  
> -	if (io->flag & EXT4_IO_END_DIRECT)
> -		inode_dio_done(inode);
>  	/* Wake up anyone waiting on unwritten extent conversion */
>  	if (atomic_dec_and_test(&EXT4_I(inode)->i_unwritten))
>  		wake_up_all(ext4_ioend_wq(inode));
> +
>  	return ret;
>  }
>  
> +void ext4_end_io_bh(ext4_io_end_t *io_end, int is_dio)
> +{
> +	struct inode *inode;
> +
> +	inode = io_end->inode;
> +	(void)ext4_es_convert_unwritten_extents(inode, io_end->offset,
> +						io_end->size);
> +	ext4_add_complete_io(io_end);
> +
> +	/*
> +	 * Here we can safely notify upper level that aio has done because
> +	 * unwritten extent in extent status tree has been converted.  Thus,
> +	 * others won't get a stale data because we always lookup extent status
> +	 * tree firstly in get_block_t.
> +	 */
> +	if (io_end->iocb)
> +		aio_complete(io_end->iocb, io_end->result, 0);
> +	if (is_dio)
> +		inode_dio_done(inode);
> +}
> +
>  static void dump_completed_IO(struct inode *inode)
>  {
>  #ifdef	EXT4FS_DEBUG
> -- 
> 1.7.12.rc2.18.g61b472e
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply

* [PATCH] serial: samsung: remove redundant setting of line config during port reset
From: Thomas Abraham @ 2012-12-31 21:42 UTC (permalink / raw)
  To: linux-serial; +Cc: gregkh, alan, kgene.kim, linux-samsung-soc

The setting of uart line control configuration in s3c24xx_serial_resetport
is can be removed since the 'set_termios' call will overwrite any ULCON
register setting which s3c24xx_serial_resetport does.

Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
---
 drivers/tty/serial/samsung.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 12e5249..e514b3a 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -1006,7 +1006,6 @@ static void s3c24xx_serial_resetport(struct uart_port *port,
 
 	ucon &= ucon_mask;
 	wr_regl(port, S3C2410_UCON,  ucon | cfg->ucon);
-	wr_regl(port, S3C2410_ULCON, cfg->ulcon);
 
 	/* reset both fifos */
 	wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);
-- 
1.7.5.4

^ permalink raw reply related

* Re: [PATCH] [media] Add common binding documentation for video interfaces
From: Rob Herring @ 2012-12-31 21:55 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: g.liakhovetski, linux-media, hverkuil, s.hauer, linux-doc,
	nicolas.thery, rob.herring, laurent.pinchart, Sylwester Nawrocki,
	devicetree-discuss
In-Reply-To: <1355606016-6509-1-git-send-email-sylvester.nawrocki@gmail.com>

On 12/15/2012 03:13 PM, Sylwester Nawrocki wrote:
> From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> This patch adds a document describing common OF bindings for video
> capture, output and video processing devices. It is currently mainly
> focused on video capture devices, with data interfaces defined in
> standards like ITU-R BT.656 or MIPI CSI-2.
> It also documents a method of describing data links between devices.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Looks reasonable. You can merge this with the rest of the series.

Acked-by: Rob Herring <rob.herring@calxeda.com>

> ---
> Hi,
> 
> This is an updated version of patch [1]. My changes include resolving
> issues pointed out during review, i.e.:
>  - renaming 'link' node to 'endpoint,
>  - renaming 'remote' phandle to 'remote-endpoint',
>  - file v4l2.txt renamed to video-interfaces.txt,
>  - removed references to V4L2,
>  - added short description of the example DT snippet
> 
> and additionally:
>  - added "Required properties' paragraph,
>  - updated description of 'data-lanes' property,
>  - renamed all erroneous occurrences of 'data-width' to 'bus-width',
>  - added 'bus-width' property description,
>  - modified description of hsync-active, vsync-active properties,
>  - added a little paragraph further explaining that each endpoint
>    node has properties determining configuration of its corresponding
>    device.
> 
> [1] https://patchwork.kernel.org/patch/1514381/
> 
> I'm still unsure about the first sentence, as these bindings can be
> used for describing SoC internal connections between modules as well.
> 
> I was considering adding something like:
> 
> "This document describes common bindings for video capture, processing
> and output devices using data buses defined in standards like ITU-R
> BT.656, MIPI CSI-2,..."
> 
> before the "General concept" paragraph.
> 
> And maybe Documentation/devicetree/bindings/video/ would a better place
> for this video-interfaces.txt file ?
> 
> Thanks,
> Sylwester
> ---
>  .../devicetree/bindings/media/video-interfaces.txt |  198 ++++++++++++++++++++
>  1 files changed, 198 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/video-interfaces.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/video-interfaces.txt b/Documentation/devicetree/bindings/media/video-interfaces.txt
> new file mode 100644
> index 0000000..10ebbc4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/video-interfaces.txt
> @@ -0,0 +1,198 @@
> +Common bindings for video data receiver and transmitter interfaces
> +
> +General concept
> +---------------
> +
> +Video data pipelines usually consist of external devices, e.g. camera sensors,
> +controlled over an I2C, SPI or UART bus, and SoC internal IP blocks, including
> +video DMA engines and video data processors.
> +
> +SoC internal blocks are described by DT nodes, placed similarly to other SoC
> +blocks.  External devices are represented as child nodes of their respective
> +bus controller nodes, e.g. I2C.
> +
> +Data interfaces on all video devices are described by their child 'port' nodes.
> +Configuration of a port depends on other devices participating in the data
> +transfer and is described by 'endpoint' subnodes.
> +
> +dev {
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	port@0 {
> +		endpoint@0 { ... };
> +		endpoint@1 { ... };
> +	};
> +	port@1 { ... };
> +};
> +
> +If a port can be configured to work with more than one other device on the same
> +bus, an 'endpoint' child node must be provided for each of them.  If more than
> +one port is present in a device node or there is more than one endpoint at a
> +port, a common scheme, using '#address-cells', '#size-cells' and 'reg' properties
> +is used.
> +
> +Two 'endpoint' nodes are linked with each other through their 'remote-endpoint'
> +phandles.  An endpoint subnode of a device contains all properties needed for
> +configuration of this device for data exchange with the other device.  In most
> +cases properties at the peer 'endpoint' nodes will be identical, however
> +they might need to be different when there are any signal modifications on the
> +bus between two devices, e.g. there are logic signal inverters on the lines.
> +
> +Required properties
> +-------------------
> +
> +If there is more that one 'port' or more than one 'endpoint' node following
> +properties are required in relevant parent node:
> +
> +- #address-cells : number of cells required to define port number, should be 1.
> +- #size-cells    : should be zero.
> +
> +Optional endpoint properties
> +----------------------------
> +
> +- remote-endpoint : phandle to an 'endpoint' subnode of the other device node.
> +- slave-mode : a boolean property, run the link in slave mode. Default is master
> +  mode.
> +- bus-width : the number of data lines, valid for parallel buses.
> +- data-shift: on parallel data busses, if bus-width is used to specify the
> +  number of data lines, data-shift can be used to specify which data lines are
> +  used, e.g. "bus-width=<10>; data-shift=<2>;" means, that lines 9:2 are used.
> +- hsync-active : active state of HSYNC signal, 0/1 for LOW/HIGH respectively.
> +- vsync-active : active state of VSYNC signal, 0/1 for LOW/HIGH respectively.
> +  Note, that if HSYNC and VSYNC polarities are not specified, embedded
> +  synchronization may be required, where supported.
> +- data-active : similar to HSYNC and VSYNC, specifies data line polarity.
> +- field-even-active: field signal level during the even field data transmission.
> +- pclk-sample : rising (1) or falling (0) edge to sample the pixel clock signal.
> +- data-lanes : an array of physical data lane indexes. Position of an entry
> +  determines logical lane number, while the value of an entry indicates physical
> +  lane, e.g. for 2-lane MIPI CSI-2 bus we could have "data-lanes = <1>, <2>;",
> +  assuming the clock lane is on hardware lane 0. This property is valid for
> +  serial buses only (e.g. MIPI CSI-2).
> +- clock-lanes : a number of physical lane used as a clock lane.
> +- clock-noncontinuous : a boolean property to allow MIPI CSI-2 non-continuous
> +  clock mode.
> +
> +Example
> +-------
> +
> +The below example snippet describes two data pipelines.  ov772x and imx074 are
> +camera sensors with parallel and serial (MIPI CSI-2) video bus respectively.
> +Both sensors are on I2C control bus corresponding to i2c0 controller node.
> +ov772x sensor is linked directly to the ceu0 video host interface.  imx074 is
> +linked to ceu0 through MIPI CSI-2 receiver (csi2). ceu0 has a (single) DMA
> +engine writing captured data to memory.  ceu0 node has single 'port' node which
> +indicates at any time only one of following data pipeline can be active:
> +ov772x -> ceu0 or imx074 -> csi2 -> ceu0.
> +
> +	ceu0: ceu@0xfe910000 {
> +		compatible = "renesas,sh-mobile-ceu";
> +		reg = <0xfe910000 0xa0>;
> +		interrupts = <0x880>;
> +
> +		mclk: master_clock {
> +			compatible = "renesas,ceu-clock";
> +			#clock-cells = <1>;
> +			clock-frequency = <50000000>;	/* Max clock frequency */
> +			clock-output-names = "mclk";
> +		};
> +
> +		port {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			ceu0_1: endpoint@1 {
> +				reg = <1>;		/* Local endpoint # */
> +				remote = <&ov772x_1_1>;	/* Remote phandle */
> +				bus-width = <8>;	/* Used data lines */
> +				data-shift = <0>;	/* Lines 7:0 are used */
> +
> +				/* If hsync-active/vsync-active are missing,
> +				   embedded bt.605 sync is used */
> +				hsync-active = <1>;	/* Active high */
> +				vsync-active = <1>;	/* Active high */
> +				data-active = <1>;	/* Active high */
> +				pclk-sample = <1>;	/* Rising */
> +			};
> +
> +			ceu0_0: endpoint@0 {
> +				reg = <0>;
> +				remote = <&csi2_2>;
> +				immutable;
> +			};
> +		};
> +	};
> +
> +	i2c0: i2c@0xfff20000 {
> +		...
> +		ov772x_1: camera@0x21 {
> +			compatible = "omnivision,ov772x";
> +			reg = <0x21>;
> +			vddio-supply = <&regulator1>;
> +			vddcore-supply = <&regulator2>;
> +
> +			clock-frequency = <20000000>;
> +			clocks = <&mclk 0>;
> +			clock-names = "xclk";
> +
> +			port {
> +				/* With 1 endpoint per port no need in addresses. */
> +				ov772x_1_1: endpoint {
> +					bus-width = <8>;
> +					remote-endpoint = <&ceu0_1>;
> +					hsync-active = <1>;
> +					vsync-active = <0>; /* Who came up with an
> +							       inverter here ?... */
> +					data-active = <1>;
> +					pclk-sample = <1>;
> +				};
> +			};
> +		};
> +
> +		imx074: camera@0x1a {
> +			compatible = "sony,imx074";
> +			reg = <0x1a>;
> +			vddio-supply = <&regulator1>;
> +			vddcore-supply = <&regulator2>;
> +
> +			clock-frequency = <30000000>;	/* Shared clock with ov772x_1 */
> +			clocks = <&mclk 0>;
> +			clock-names = "sysclk";		/* Assuming this is the
> +							   name in the datasheet */
> +			port {
> +				imx074_1: endpoint {
> +					clock-lanes = <0>;
> +					data-lanes = <1>, <2>;
> +					remote-endpoint = <&csi2_1>;
> +				};
> +			};
> +		};
> +	};
> +
> +	csi2: csi2@0xffc90000 {
> +		compatible = "renesas,sh-mobile-csi2";
> +		reg = <0xffc90000 0x1000>;
> +		interrupts = <0x17a0>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		port@1 {
> +			compatible = "renesas,csi2c";	/* One of CSI2I and CSI2C. */
> +			reg = <1>;			/* CSI-2 PHY #1 of 2: PHY_S,
> +							   PHY_M has port address 0,
> +							   is unused. */
> +			csi2_1: endpoint {
> +				clock-lanes = <0>;
> +				data-lanes = <2>, <1>;
> +				remote-endpoint = <&imx074_1>;
> +			};
> +		};
> +		port@2 {
> +			reg = <2>;			/* port 2: link to the CEU */
> +
> +			csi2_2: endpoint {
> +				immutable;
> +				remote-endpoint = <&ceu0_0>;
> +			};
> +		};
> +	};
> --
> 1.7.4.1
> 
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
> 


^ permalink raw reply

* Re: [RFC][PATCH 3/9 v1] ext4: add physical block and status member into extent status tree
From: Jan Kara @ 2012-12-31 21:49 UTC (permalink / raw)
  To: Zheng Liu; +Cc: linux-ext4, Zheng Liu
In-Reply-To: <1356335742-11793-4-git-send-email-wenqing.lz@taobao.com>

On Mon 24-12-12 15:55:36, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> es_pblk is used to record physical block that maps to the disk.  es_status is
> used to record the status of the extent.  Three status are defined, which are
> written, unwritten and delayed.
  So this means one extent is 48 bytes on 64-bit architectures. If I'm a
nasty user and create artificially fragmented file (by allocating every
second block), extent tree takes 6 MB per GB of file. That's quite a bit
and I think you need to provide a way for kernel to reclaim extent
structures...

								Honza
> 
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  fs/ext4/extents_status.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/ext4/extents_status.h b/fs/ext4/extents_status.h
> index 81e9339..85115bb 100644
> --- a/fs/ext4/extents_status.h
> +++ b/fs/ext4/extents_status.h
> @@ -20,10 +20,18 @@
>  #define es_debug(fmt, ...)	no_printk(fmt, ##__VA_ARGS__)
>  #endif
>  
> +enum {
> +	EXTENT_STATUS_WRITTEN = 0,	/* written extent */
> +	EXTENT_STATUS_UNWRITTEN = 1,	/* unwritten extent */
> +	EXTENT_STATUS_DELAYED = 2,	/* delayed extent */
> +};
> +
>  struct extent_status {
>  	struct rb_node rb_node;
>  	ext4_lblk_t es_lblk;	/* first logical block extent covers */
>  	ext4_lblk_t es_len;	/* length of extent in block */
> +	ext4_fsblk_t es_pblk;	/* first physical block */
> +	int es_status;		/* record the status of extent */
>  };
>  
>  struct ext4_es_tree {
> -- 
> 1.7.12.rc2.18.g61b472e
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply

* Re: [Qemu-devel] [PATCH] linux-user: correct setsockopt() SO_SNDTIMEO and SO_RCVTIMEO take a struct timeval, not an int
From: Peter Maydell @ 2012-12-31 21:40 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Riku Voipio, qemu-devel
In-Reply-To: <1356983610-14793-1-git-send-email-laurent@vivier.eu>

On 31 December 2012 19:53, Laurent Vivier <laurent@vivier.eu> wrote:
> From: Laurent Vivier <Laurent@Vivier.EU>

Looks about right (though the goto is a little ugly). You have some
style issues you need to fix, though.

thanks
-- PMM

^ permalink raw reply

* cron job: media_tree daily build: ERRORS
From: Hans Verkuil @ 2012-12-31 21:39 UTC (permalink / raw)
  To: linux-media

This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:        Mon Dec 31 19:00:18 CET 2012
git hash:    b858c331cdf402853be2c48c8f4f77173ef04da8
gcc version:      i686-linux-gcc (GCC) 4.7.1
host hardware:    x86_64
host os:          3.4.07-marune

linux-git-arm-eabi-davinci: WARNINGS
linux-git-arm-eabi-exynos: OK
linux-git-arm-eabi-omap: ERRORS
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: WARNINGS
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: WARNINGS
linux-2.6.31.12-i686: WARNINGS
linux-2.6.32.6-i686: WARNINGS
linux-2.6.33-i686: WARNINGS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-i686: WARNINGS
linux-3.5-i686: WARNINGS
linux-3.6-i686: WARNINGS
linux-3.7-i686: WARNINGS
linux-3.8-rc1-i686: WARNINGS
linux-2.6.31.12-x86_64: WARNINGS
linux-2.6.32.6-x86_64: WARNINGS
linux-2.6.33-x86_64: WARNINGS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
linux-3.4-x86_64: WARNINGS
linux-3.5-x86_64: WARNINGS
linux-3.6-x86_64: WARNINGS
linux-3.7-x86_64: WARNINGS
linux-3.8-rc1-x86_64: WARNINGS
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2

The V4L-DVB specification from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html

^ permalink raw reply

* [PATCH v3] input: vt8500: Add power button keypad driver
From: Tony Prisk @ 2012-12-31 21:34 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for the Power Button keypad found on
Wondermedia netbooks/tablets.

A keymap property is exposed to allowing defining the key
event to be generated when the power button is pressed.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
CC: linux-kernel at vger.kernel.org
CC: linux-arm-kernel at lists.infradead.org
CC: vt8500-wm8505-linux-kernel at googlegroups.com
CC: linux-input at vger.kernel.org

v2:
Remove devicetree binding for keycode
Add dependency on OF in Kconfig
Move static variables in a struct
Remove redundant inline modifier from kpad_power_timeout()
Remove unneccessary checks against power_button_pressed. Drop variable.
Cleanup the fail path code and add a .remove function.
Change the button behaviour so that a key-released event is only generated once
the key is released, not after timeout.
*Changes tested on WM8650 tablet.

v3:
Remove dependency on PMC node, and change binding document accordingly.
Remove mod_timer call in kpad_power_timeout()
Unmap io memory in fail path and .remove
Update name & phys fields to be more meaningful
Use del_timer_sync rather than del_timer
Fix usage of input_unregister_device/input_free_device

 .../bindings/input/vt8500-power-keypad.txt         |   17 ++
 drivers/input/keyboard/Kconfig                     |   10 ++
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/wmt_power_keypad.c          |  182 ++++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
 create mode 100644 drivers/input/keyboard/wmt_power_keypad.c

diff --git a/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
new file mode 100644
index 0000000..f6996d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
@@ -0,0 +1,17 @@
+* Wondermedia Power Keypad device tree bindings
+
+Wondermedia SoCs have a single irq-driven power button attached to
+the power management controller.
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+   - "wm,power-keypad": For all Wondermedia 8xxx-series SoCs.
+- reg : Should contain the register range of the Power Mgmt controller
+- interrupts: should be the power management controller wakeup interrupt.
+
+Example:
+	powerkey: pwrkey at 0 {
+		compatible = "wm,power-keypad";
+		reg = <0xd8130000 0x1000>;
+		interrupts = <22>;
+	};
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 5a240c6..bb1e04f 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -595,6 +595,16 @@ config KEYBOARD_TWL4030
 	  To compile this driver as a module, choose M here: the
 	  module will be called twl4030_keypad.
 
+config KEYBOARD_WMT_POWER_KEYPAD
+	tristate "Wondermedia Power keypad support"
+	depends on (OF && ARCH_VT8500)
+	help
+	  Say Y here to enable support for the power button keypad
+	  on Wondermedia 8xxx-series SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called wmt_power_keypad.
+
 config KEYBOARD_XTKBD
 	tristate "XT keyboard"
 	select SERIO
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 44e7600..eea31af 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -52,5 +52,6 @@ obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
 obj-$(CONFIG_KEYBOARD_TNETV107X)	+= tnetv107x-keypad.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
+obj-$(CONFIG_KEYBOARD_WMT_POWER_KEYPAD)	+= wmt_power_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
 obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
diff --git a/drivers/input/keyboard/wmt_power_keypad.c b/drivers/input/keyboard/wmt_power_keypad.c
new file mode 100644
index 0000000..383b73e
--- /dev/null
+++ b/drivers/input/keyboard/wmt_power_keypad.c
@@ -0,0 +1,182 @@
+/* Wondermedia Power Keypad
+ *
+ * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/bitops.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_device.h>
+
+struct kpad_pwr_data {
+	struct input_dev	*kpad_power;
+	void __iomem		*pmc_base;
+	int			irq;
+	struct timer_list	timer;
+	spinlock_t		lock;
+	unsigned int		keycode;
+};
+
+static void kpad_power_timeout(unsigned long fcontext)
+{
+	struct kpad_pwr_data *data = (struct kpad_pwr_data *)fcontext;
+	unsigned long flags;
+
+	spin_lock_irqsave(&data->lock, flags);
+
+	input_report_key(data->kpad_power, data->keycode, 0);
+	input_sync(data->kpad_power);
+
+	spin_unlock_irqrestore(&data->lock, flags);
+}
+
+static irqreturn_t kpad_power_isr(int irq_num, void *priv)
+{
+	struct kpad_pwr_data *data = priv;
+	u32 status;
+	unsigned long flags;
+
+	spin_lock_irqsave(&data->lock, flags);
+
+	status = readl(data->pmc_base + 0x14);
+	writel(status, data->pmc_base + 0x14);
+
+	if (status & BIT(14)) {
+		input_report_key(data->kpad_power, data->keycode, 1);
+		input_sync(data->kpad_power);
+		mod_timer(&data->timer, jiffies + msecs_to_jiffies(250));
+	}
+
+	spin_unlock_irqrestore(&data->lock, flags);
+
+	return IRQ_HANDLED;
+}
+
+static int vt8500_pwr_kpad_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct kpad_pwr_data *data;
+	u32 status;
+	int err;
+
+	if (!np) {
+		dev_err(&pdev->dev, "devicenode not found\n");
+		return -ENODEV;
+	}
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data) {
+		dev_err(&pdev->dev, "unable to allocate private data\n");
+		return -ENOMEM;
+	}
+
+	platform_set_drvdata(pdev, data);
+	data->keycode = KEY_POWER;
+	spin_lock_init(&data->lock);
+
+	data->pmc_base = of_iomap(np, 0);
+	if (!data->pmc_base) {
+		dev_err(&pdev->dev, "unable to map pmc memory\n");
+		return -ENOMEM;
+	}
+
+	/* set power button to soft-power */
+	status = readl(data->pmc_base + 0x54);
+	writel(status | 1, data->pmc_base + 0x54);
+
+	/* clear any pending interrupts */
+	status = readl(data->pmc_base + 0x14);
+	writel(status, data->pmc_base + 0x14);
+
+	data->kpad_power = input_allocate_device();
+	if (!data->kpad_power) {
+		dev_err(&pdev->dev, "failed to allocate input device\n");
+		return -ENOMEM;
+	}
+
+	input_set_capability(data->kpad_power, EV_KEY, data->keycode);
+
+	data->kpad_power->name = "Wondermedia Power Button";
+	data->kpad_power->phys = "vt8500-pmc/input0";
+	data->kpad_power->keycode = &data->keycode;
+	data->kpad_power->keycodesize = sizeof(unsigned int);
+	data->kpad_power->keycodemax = 1;
+
+	setup_timer(&data->timer, kpad_power_timeout, (unsigned long)data);
+
+	data->irq = irq_of_parse_and_map(np, 0);
+	err = request_irq(data->irq, &kpad_power_isr, 0, "pwrbtn", data);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to request irq\n");
+		goto cleanup_irq;
+	}
+
+	err = input_register_device(data->kpad_power);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		goto cleanup_input;
+	}
+
+	return 0;
+
+cleanup_input:
+	free_irq(data->irq, NULL);
+cleanup_irq:
+	del_timer(&data->timer);
+	input_free_device(data->kpad_power);
+	iounmap(data->pmc_base);
+	return err;
+}
+
+static int vt8500_pwr_kpad_remove(struct platform_device *pdev)
+
+{
+	struct kpad_pwr_data *data = platform_get_drvdata(pdev);
+
+	free_irq(data->irq, data);
+	del_timer_sync(&data->timer);
+	input_unregister_device(data->kpad_power);
+	iounmap(data->pmc_base);
+
+	return 0;
+}
+
+
+static struct of_device_id vt8500_pwr_kpad_dt_ids[] = {
+	{ .compatible = "wm,power-keypad" },
+	{ /* Sentinel */ },
+};
+
+static struct platform_driver vt8500_pwr_kpad_driver = {
+	.probe		= vt8500_pwr_kpad_probe,
+	.remove		= vt8500_pwr_kpad_remove,
+	.driver		= {
+		.name	= "wmt-power-keypad",
+		.owner	= THIS_MODULE,
+		.of_match_table = vt8500_pwr_kpad_dt_ids,
+	},
+};
+
+module_platform_driver(vt8500_pwr_kpad_driver);
+
+MODULE_DESCRIPTION("Wondermedia Power Keypad Driver");
+MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>");
+MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, vt8500_pwr_kpad_dt_ids);
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH v3] input: vt8500: Add power button keypad driver
From: Tony Prisk @ 2012-12-31 21:34 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Tony Prisk, linux-kernel, linux-arm-kernel,
	vt8500-wm8505-linux-kernel, linux-input

This patch adds support for the Power Button keypad found on
Wondermedia netbooks/tablets.

A keymap property is exposed to allowing defining the key
event to be generated when the power button is pressed.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
CC: linux-kernel@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org
CC: vt8500-wm8505-linux-kernel@googlegroups.com
CC: linux-input@vger.kernel.org

v2:
Remove devicetree binding for keycode
Add dependency on OF in Kconfig
Move static variables in a struct
Remove redundant inline modifier from kpad_power_timeout()
Remove unneccessary checks against power_button_pressed. Drop variable.
Cleanup the fail path code and add a .remove function.
Change the button behaviour so that a key-released event is only generated once
the key is released, not after timeout.
*Changes tested on WM8650 tablet.

v3:
Remove dependency on PMC node, and change binding document accordingly.
Remove mod_timer call in kpad_power_timeout()
Unmap io memory in fail path and .remove
Update name & phys fields to be more meaningful
Use del_timer_sync rather than del_timer
Fix usage of input_unregister_device/input_free_device

 .../bindings/input/vt8500-power-keypad.txt         |   17 ++
 drivers/input/keyboard/Kconfig                     |   10 ++
 drivers/input/keyboard/Makefile                    |    1 +
 drivers/input/keyboard/wmt_power_keypad.c          |  182 ++++++++++++++++++++
 4 files changed, 210 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
 create mode 100644 drivers/input/keyboard/wmt_power_keypad.c

diff --git a/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
new file mode 100644
index 0000000..f6996d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
@@ -0,0 +1,17 @@
+* Wondermedia Power Keypad device tree bindings
+
+Wondermedia SoCs have a single irq-driven power button attached to
+the power management controller.
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+   - "wm,power-keypad": For all Wondermedia 8xxx-series SoCs.
+- reg : Should contain the register range of the Power Mgmt controller
+- interrupts: should be the power management controller wakeup interrupt.
+
+Example:
+	powerkey: pwrkey@0 {
+		compatible = "wm,power-keypad";
+		reg = <0xd8130000 0x1000>;
+		interrupts = <22>;
+	};
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 5a240c6..bb1e04f 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -595,6 +595,16 @@ config KEYBOARD_TWL4030
 	  To compile this driver as a module, choose M here: the
 	  module will be called twl4030_keypad.
 
+config KEYBOARD_WMT_POWER_KEYPAD
+	tristate "Wondermedia Power keypad support"
+	depends on (OF && ARCH_VT8500)
+	help
+	  Say Y here to enable support for the power button keypad
+	  on Wondermedia 8xxx-series SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called wmt_power_keypad.
+
 config KEYBOARD_XTKBD
 	tristate "XT keyboard"
 	select SERIO
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
index 44e7600..eea31af 100644
--- a/drivers/input/keyboard/Makefile
+++ b/drivers/input/keyboard/Makefile
@@ -52,5 +52,6 @@ obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
 obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
 obj-$(CONFIG_KEYBOARD_TNETV107X)	+= tnetv107x-keypad.o
 obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
+obj-$(CONFIG_KEYBOARD_WMT_POWER_KEYPAD)	+= wmt_power_keypad.o
 obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
 obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
diff --git a/drivers/input/keyboard/wmt_power_keypad.c b/drivers/input/keyboard/wmt_power_keypad.c
new file mode 100644
index 0000000..383b73e
--- /dev/null
+++ b/drivers/input/keyboard/wmt_power_keypad.c
@@ -0,0 +1,182 @@
+/* Wondermedia Power Keypad
+ *
+ * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/bitops.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_device.h>
+
+struct kpad_pwr_data {
+	struct input_dev	*kpad_power;
+	void __iomem		*pmc_base;
+	int			irq;
+	struct timer_list	timer;
+	spinlock_t		lock;
+	unsigned int		keycode;
+};
+
+static void kpad_power_timeout(unsigned long fcontext)
+{
+	struct kpad_pwr_data *data = (struct kpad_pwr_data *)fcontext;
+	unsigned long flags;
+
+	spin_lock_irqsave(&data->lock, flags);
+
+	input_report_key(data->kpad_power, data->keycode, 0);
+	input_sync(data->kpad_power);
+
+	spin_unlock_irqrestore(&data->lock, flags);
+}
+
+static irqreturn_t kpad_power_isr(int irq_num, void *priv)
+{
+	struct kpad_pwr_data *data = priv;
+	u32 status;
+	unsigned long flags;
+
+	spin_lock_irqsave(&data->lock, flags);
+
+	status = readl(data->pmc_base + 0x14);
+	writel(status, data->pmc_base + 0x14);
+
+	if (status & BIT(14)) {
+		input_report_key(data->kpad_power, data->keycode, 1);
+		input_sync(data->kpad_power);
+		mod_timer(&data->timer, jiffies + msecs_to_jiffies(250));
+	}
+
+	spin_unlock_irqrestore(&data->lock, flags);
+
+	return IRQ_HANDLED;
+}
+
+static int vt8500_pwr_kpad_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct kpad_pwr_data *data;
+	u32 status;
+	int err;
+
+	if (!np) {
+		dev_err(&pdev->dev, "devicenode not found\n");
+		return -ENODEV;
+	}
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data) {
+		dev_err(&pdev->dev, "unable to allocate private data\n");
+		return -ENOMEM;
+	}
+
+	platform_set_drvdata(pdev, data);
+	data->keycode = KEY_POWER;
+	spin_lock_init(&data->lock);
+
+	data->pmc_base = of_iomap(np, 0);
+	if (!data->pmc_base) {
+		dev_err(&pdev->dev, "unable to map pmc memory\n");
+		return -ENOMEM;
+	}
+
+	/* set power button to soft-power */
+	status = readl(data->pmc_base + 0x54);
+	writel(status | 1, data->pmc_base + 0x54);
+
+	/* clear any pending interrupts */
+	status = readl(data->pmc_base + 0x14);
+	writel(status, data->pmc_base + 0x14);
+
+	data->kpad_power = input_allocate_device();
+	if (!data->kpad_power) {
+		dev_err(&pdev->dev, "failed to allocate input device\n");
+		return -ENOMEM;
+	}
+
+	input_set_capability(data->kpad_power, EV_KEY, data->keycode);
+
+	data->kpad_power->name = "Wondermedia Power Button";
+	data->kpad_power->phys = "vt8500-pmc/input0";
+	data->kpad_power->keycode = &data->keycode;
+	data->kpad_power->keycodesize = sizeof(unsigned int);
+	data->kpad_power->keycodemax = 1;
+
+	setup_timer(&data->timer, kpad_power_timeout, (unsigned long)data);
+
+	data->irq = irq_of_parse_and_map(np, 0);
+	err = request_irq(data->irq, &kpad_power_isr, 0, "pwrbtn", data);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to request irq\n");
+		goto cleanup_irq;
+	}
+
+	err = input_register_device(data->kpad_power);
+	if (err < 0) {
+		dev_err(&pdev->dev, "failed to register input device\n");
+		goto cleanup_input;
+	}
+
+	return 0;
+
+cleanup_input:
+	free_irq(data->irq, NULL);
+cleanup_irq:
+	del_timer(&data->timer);
+	input_free_device(data->kpad_power);
+	iounmap(data->pmc_base);
+	return err;
+}
+
+static int vt8500_pwr_kpad_remove(struct platform_device *pdev)
+
+{
+	struct kpad_pwr_data *data = platform_get_drvdata(pdev);
+
+	free_irq(data->irq, data);
+	del_timer_sync(&data->timer);
+	input_unregister_device(data->kpad_power);
+	iounmap(data->pmc_base);
+
+	return 0;
+}
+
+
+static struct of_device_id vt8500_pwr_kpad_dt_ids[] = {
+	{ .compatible = "wm,power-keypad" },
+	{ /* Sentinel */ },
+};
+
+static struct platform_driver vt8500_pwr_kpad_driver = {
+	.probe		= vt8500_pwr_kpad_probe,
+	.remove		= vt8500_pwr_kpad_remove,
+	.driver		= {
+		.name	= "wmt-power-keypad",
+		.owner	= THIS_MODULE,
+		.of_match_table = vt8500_pwr_kpad_dt_ids,
+	},
+};
+
+module_platform_driver(vt8500_pwr_kpad_driver);
+
+MODULE_DESCRIPTION("Wondermedia Power Keypad Driver");
+MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>");
+MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, vt8500_pwr_kpad_dt_ids);
-- 
1.7.9.5

^ permalink raw reply related

* [RFC] btrfs send without data updates?
From: Mark Fasheh @ 2012-12-31 21:33 UTC (permalink / raw)
  To: chris.mason, ablock84; +Cc: Jeff Mahoney, linux-btrfs

Hi Chris! Hi Alexander!

I'm working on the kernel side of a feature request we have from the snapper
developers. Snapper can be used (in conjunction) with btrfs on openSUSE to
roll back system changes made via YaST and zypper.

If you want to know more, you can see the following page:

http://doc.opensuse.org/documentation/html/openSUSE/opensuse-reference/cha.snapper.html

Right now snapper does this by running 'find' and 'diff' against snapshots
it has taken. This is obviously expensive and we're looking at something
like the btrfs send ioctl to reduce the overhead during this operation.

In fact, send works quite nicely except that it always reads changed file
data from disk and puts it in the stream - snapper doesn't want this
overhead and would prefer to produce the changed data itself. Knowing that
there *was* a data update however is still critical.

So I have a conceptually simple patch which passes a flag to modify this
behavior. The patch is included below however I will quote the description
here: 

 "This patch adds the flag, BTRFS_SEND_FLAG_NO_FILE_DATA to the btrfs send
  ioctl code. When this flag is set, the btrfs send code will never write file
  data into the stream (thus also avoiding expensive reads of that data in the
  first place). BTRFS_SEND_C_UPDATE_EXTENT commands will be sent (instead of
  BTRFS_SEND_C_WRITE) with an offset, length pair indicating the extent in
  question.

  This patch does not affect the operation of BTRFS_SEND_C_CLONE commands -
  they will continue to be sent when a search finds an appropriate extent to
  clone from."


What do you all think of this approach? Is it too ugly to put a conditional
command in the stream? Do we want to just add another ioctl? I'm loathe to
go in *that* direction because I fear I'd be replicating most of the send
code _anyway_ (well, it could just be a wrapper ioctl()).

Thanks in advance for looking at this.
	--Mark

--
Mark Fasheh


From: Mark Fasheh <mfasheh@suse.de>

btrfs: add "no file data" flag to btrfs send ioctl

This patch adds the flag, BTRFS_SEND_FLAG_NO_FILE_DATA to the btrfs send
ioctl code. When this flag is set, the btrfs send code will never write file
data into the stream (thus also avoiding expensive reads of that data in the
first place). BTRFS_SEND_C_UPDATE_EXTENT commands will be sent (instead of
BTRFS_SEND_C_WRITE) with an offset, length pair indicating the extent in
question.

This patch does not affect the operation of BTRFS_SEND_C_CLONE commands -
they will continue to be sent when a search finds an appropriate extent to
clone from.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 fs/btrfs/ioctl.h |    7 +++++++
 fs/btrfs/send.c  |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 fs/btrfs/send.h  |    1 +
 3 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ioctl.h b/fs/btrfs/ioctl.h
index 731e287..1f6cfdd 100644
--- a/fs/btrfs/ioctl.h
+++ b/fs/btrfs/ioctl.h
@@ -363,6 +363,13 @@ struct btrfs_ioctl_received_subvol_args {
 	__u64	reserved[16];		/* in */
 };
 
+/*
+ * Caller doesn't want file data in the send stream, even if the
+ * search of clone sources doesn't find an extent. UPDATE_EXTENT
+ * commands will be sent instead of WRITE commands.
+ */
+#define BTRFS_SEND_FLAG_NO_FILE_DATA     0x1
+
 struct btrfs_ioctl_send_args {
 	__s64 send_fd;			/* in */
 	__u64 clone_sources_count;	/* in */
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index e78b297..f97b5e6 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -85,6 +85,7 @@ struct send_ctx {
 	u32 send_max_size;
 	u64 total_send_size;
 	u64 cmd_send_size[BTRFS_SEND_C_MAX + 1];
+	u64 flags;	/* 'flags' member of btrfs_ioctl_send_args is u64 */
 
 	struct vfsmount *mnt;
 
@@ -3707,6 +3708,42 @@ out:
 	return ret;
 }
 
+/*
+ * Send an update extent command to user space.
+ */
+static int send_update_extent(struct send_ctx *sctx,
+			      u64 offset, u32 len)
+{
+	int ret = 0;
+	struct fs_path *p;
+
+verbose_printk("btrfs: send_update_extent offset=%llu, len=%d\n", offset, len);
+
+	p = fs_path_alloc(sctx);
+	if (!p)
+		return -ENOMEM;
+
+	ret = begin_cmd(sctx, BTRFS_SEND_C_UPDATE_EXTENT);
+	if (ret < 0)
+		goto out;
+
+	ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, p);
+	if (ret < 0)
+		goto out;
+
+	TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
+	TLV_PUT_U64(sctx, BTRFS_SEND_A_CLONE_LEN, len);
+	TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p);
+	TLV_PUT_U64(sctx, BTRFS_SEND_A_SIZE, len);
+
+	ret = send_cmd(sctx);
+
+tlv_put_failure:
+out:
+	fs_path_free(sctx, p);
+	return ret;
+}
+
 static int send_write_or_clone(struct send_ctx *sctx,
 			       struct btrfs_path *path,
 			       struct btrfs_key *key,
@@ -3742,7 +3779,11 @@ static int send_write_or_clone(struct send_ctx *sctx,
 		goto out;
 	}
 
-	if (!clone_root) {
+	if (clone_root) {
+		ret = send_clone(sctx, offset, len, clone_root);
+	} else if (sctx->flags & BTRFS_SEND_FLAG_NO_FILE_DATA) {
+		ret = send_update_extent(sctx, offset, len);
+	} else {
 		while (pos < len) {
 			l = len - pos;
 			if (l > BTRFS_SEND_READ_SIZE)
@@ -3755,10 +3796,7 @@ static int send_write_or_clone(struct send_ctx *sctx,
 			pos += ret;
 		}
 		ret = 0;
-	} else {
-		ret = send_clone(sctx, offset, len, clone_root);
 	}
-
 out:
 	return ret;
 }
@@ -4570,6 +4608,8 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
 	INIT_RADIX_TREE(&sctx->name_cache, GFP_NOFS);
 	INIT_LIST_HEAD(&sctx->name_cache_list);
 
+	sctx->flags = arg->flags;
+
 	sctx->send_filp = fget(arg->send_fd);
 	if (IS_ERR(sctx->send_filp)) {
 		ret = PTR_ERR(sctx->send_filp);
diff --git a/fs/btrfs/send.h b/fs/btrfs/send.h
index 1bf4f32..8bb18f7 100644
--- a/fs/btrfs/send.h
+++ b/fs/btrfs/send.h
@@ -86,6 +86,7 @@ enum btrfs_send_cmd {
 	BTRFS_SEND_C_UTIMES,
 
 	BTRFS_SEND_C_END,
+	BTRFS_SEND_C_UPDATE_EXTENT,
 	__BTRFS_SEND_C_MAX,
 };
 #define BTRFS_SEND_C_MAX (__BTRFS_SEND_C_MAX - 1)
-- 
1.7.7


^ permalink raw reply related

* Re: [Qemu-devel] [PATCH 2/2] linux-user: SOCK_PACKET uses network endian to encode protocol in socket()
From: Peter Maydell @ 2012-12-31 21:32 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Riku Voipio, qemu-devel
In-Reply-To: <1356982680-12436-3-git-send-email-laurent@vivier.eu>

On 31 December 2012 19:38, Laurent Vivier <laurent@vivier.eu> wrote:
> @@ -1900,6 +1900,12 @@ static abi_long do_socket(int domain, int type, int protocol)
>  #endif
>      if (domain == PF_NETLINK)
>          return -EAFNOSUPPORT; /* do not NETLINK socket connections possible */
> +    if (type == SOCK_PACKET) {
> +        /* in this case, socket() needs a network endian short */
> +        protocol = tswapal(protocol); /* restore network endian long */
> +        protocol = abi_ntohl(protocol); /* a host endian long */
> +        protocol = htons(protocol); /* network endian short */
> +    }

Are you sure this is correct for little endian guests? I've only
desk-checked it rather than running a test program, but it looks
to me like you end up passing the wrong value to socket().

Also it seems rather involved since we swap things three times and
have an entirely new abi_* function. Either I'm completely confused
or it should be enough to just have

if (type == SOCK_PACKET) {
      protocol = tswap16(protocol);
}

-- PMM

^ permalink raw reply

* Compat-wireless release for 2012-12-31 is baked
From: Compat-wireless cronjob account @ 2012-12-31 21:14 UTC (permalink / raw)
  To: backports

git fetch github (/var/opt/compat/compat-wireless-2.6)
Nothing new to pack.
HEAD is now at 91cd77f compat-drivers: refresh patches
git fetch github (/var/opt/compat/compat)
Nothing new to pack.
HEAD is now at 681f758 compat: export platform_device_register_data()
git fetch  (/var/opt/compat/linux-next)
Nothing new to pack.
HEAD is now at 3979da7 Add linux-next specific files for 20121224
/var/opt/compat//compat-ksrc/lib/modules does not exist
Failed...

compat-drivers code metrics

   1270452 - Total upstream lines of code being pulled

   network
   ----------------------------------------
      3076 - backport code changes
      2581 - backport code additions
       495 - backport code deletions
     14599 - backport from compat module
     17675 - total backport code
    1.3912 - % of code consists of backport work

   drm
   ----------------------------------------
       436 - backport code changes
       293 - backport code additions
       143 - backport code deletions
     14599 - backport from compat module
     15035 - total backport code
    1.1834 - % of code consists of backport work

Base tree: linux-next.git
Base tree version: next-20121224
compat.git: compat-2012-12-24
compat-drivers release: compat-drivers-2012-12-24
Code metrics archive: http://bit.ly/H6BTF7

^ permalink raw reply

* Re: [PATCH] prctl: fix validation of an address
From: Serge E. Hallyn @ 2012-12-31 21:12 UTC (permalink / raw)
  To: Cyrill Gorcunov
  Cc: Eric Paris, Andrew Vagin, Andrey Vagin, linux-kernel,
	Andrew Morton, Kees Cook, Serge Hallyn, Eric W. Biederman,
	James Morris
In-Reply-To: <20121231151356.GA11118@moon>

Quoting Cyrill Gorcunov (gorcunov@openvz.org):
> > The kernel makes the decision on what is valid via security_mmap_addr().
> > Assuming there are no security fears of an untrusted application
> > tricking some priviledged application to set up these maps the answer is
> > just calling security_mmap_addr() instead of doing if(addr <
> > mmap_min_addr) return -EINVAL;
> 
> If only I've not missed something obvious, the check for security_mmap_addr() here
> instead of poking the mmap_min_addr looks more correct for me. Andrew?

That sounds right to me as well.

-serge

^ permalink raw reply

* Re: [PATCH v2] input: vt8500: Add power button keypad driver
From: Tony Prisk @ 2012-12-31 21:11 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: linux-kernel, linux-arm-kernel, vt8500-wm8505-linux-kernel,
	linux-input
In-Reply-To: <20121231203713.GC20317@core.coreip.homeip.net>

On Mon, 2012-12-31 at 12:37 -0800, Dmitry Torokhov wrote:
> Hi Tony,
> 
> On Mon, Dec 31, 2012 at 03:04:59PM +1300, Tony Prisk wrote:
> > This patch adds support for the Power Button keypad found on
> > Wondermedia netbooks/tablets.
> > 
> > Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> > ---
> > v2:
> > Remove devicetree binding for keycode
> > Add dependency on OF in Kconfig
> > Move static variables in a struct
> > Remove redundant inline modifier from kpad_power_timeout()
> > Remove unneccessary checks against power_button_pressed. Drop variable.
> > Cleanup the fail path code and add a .remove function.
> > Change the button behaviour so that a key-released event is only generated once
> > the key is released, not after timeout.
> > *Changes tested on WM8650 tablet.
> 
> 
> Thank you for making the requested changes, unfortunately there is some
> more...
It's never unfortunate to get it right :)
> 
> > 
> > +	status = readl(data->pmc_base + 0x14);
> > +	if (status & BIT(14)) {
> > +		/* Button isn't release so check again in 50ms */
> > +		mod_timer(&data->timer, jiffies + msecs_to_jiffies(50));
> 
> I do not think you need to do this: your ISR does "mod_timer" which
> means that the timer expiration gets extended every time there is
> interrupt, so as long as the button is pressed the timer will not run.
> So I'd just report the button as released here and be done with it.
Will fix.

> > +
> > +	np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
> > +	if (!np) {
> > +		dev_err(&pdev->dev, "pmc node not found\n");
> > +		return -EINVAL;
> > +	}
> 
> Hmm, why are we looking up another device? What is it is not there yet?
> Can we have all resources contained in this device DT description?

This driver uses registers in the power management controller. It didn't
seem right to declare the memory space for this device as well as the PM
controller, but I don't think there is any reason why it couldn't - just
seemed a bit backward to me.

> > +	data->pmc_base = of_iomap(np, 0);
> > +	if (!data->pmc_base) {
> > +		dev_err(&pdev->dev, "unable to map pmc memory\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	np = pdev->dev.of_node;
> > +	if (!np) {
> > +		dev_err(&pdev->dev, "devicenode not found\n");
> 
> Your error handling is still incomplete, you need to unmap the memory
> you just mapped above.
Will do.
> 
> I happened to peek at other vt8500 drivers and the lack of proper error
> handling and absence of remove() methods is a common theme among them.
Will put this on my list of things to look into. Thanks for pointing it
out.
> 
> > +
> > +	data->kpad_power->evbit[0] = BIT_MASK(EV_KEY);
> > +	set_bit(data->keycode, data->kpad_power->keybit);
> 
> Make it:
> 
> 	input_set_capability(data->kpad_power, EV_KEY, data->keycode);
OK.
> 
> > +
> > +	data->kpad_power->name = "wmt_power_keypad";
> > +	data->kpad_power->phys = "wmt_power_keypad";
> 
> You can have more "human" name in name field, you do not have to have
> underscores. Also if you want to use phys it is common to have it in
> form of "<parent device>/input0" so something like "vt8500-pmic/input0".
Thanks.
> 
> > +	data->kpad_power->keycode = &data->keycode;
> > +	data->kpad_power->keycodesize = sizeof(unsigned int);
> > +	data->kpad_power->keycodemax = 1;
> > +
> > +	err = input_register_device(data->kpad_power);
> > +	if (err < 0) {
> > +		dev_err(&pdev->dev, "failed to register input device\n");
> > +		goto cleanup_input;
> > +	}
> > +
> 
> I'd recommend registering input device after you request irq as it
> simplifies error path (it is OK for ISR to use allocated but not
> registered input device).
Sounds good.
> 
> > +
> > +static int vt8500_pwr_kpad_remove(struct platform_device *pdev)
> > +
> > +{
> > +	struct kpad_pwr_data *data = platform_get_drvdata(pdev);
> > +
> > +	free_irq(data->irq, data);
> > +	del_timer(&data->timer);
> 
> This should be del_timer_sync().
OK.
> 
> > +	input_unregister_device(data->kpad_power);
> > +	input_free_device(data->kpad_power);
> 
> input_free_device() after input_unregister_device() will result in
> double-free. The rule is use input_free_device() if device has not been
> registered, otherwise use input_unregister_device().
That seems a little unintuitive given the functions seemed to be paired.
Will fix. Thanks.
> 
> You also need to unmap the mapped region.
Will do.



Regards
Tony P


^ permalink raw reply

* [PATCH v2] input: vt8500: Add power button keypad driver
From: Tony Prisk @ 2012-12-31 21:11 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121231203713.GC20317@core.coreip.homeip.net>

On Mon, 2012-12-31 at 12:37 -0800, Dmitry Torokhov wrote:
> Hi Tony,
> 
> On Mon, Dec 31, 2012 at 03:04:59PM +1300, Tony Prisk wrote:
> > This patch adds support for the Power Button keypad found on
> > Wondermedia netbooks/tablets.
> > 
> > Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> > ---
> > v2:
> > Remove devicetree binding for keycode
> > Add dependency on OF in Kconfig
> > Move static variables in a struct
> > Remove redundant inline modifier from kpad_power_timeout()
> > Remove unneccessary checks against power_button_pressed. Drop variable.
> > Cleanup the fail path code and add a .remove function.
> > Change the button behaviour so that a key-released event is only generated once
> > the key is released, not after timeout.
> > *Changes tested on WM8650 tablet.
> 
> 
> Thank you for making the requested changes, unfortunately there is some
> more...
It's never unfortunate to get it right :)
> 
> > 
> > +	status = readl(data->pmc_base + 0x14);
> > +	if (status & BIT(14)) {
> > +		/* Button isn't release so check again in 50ms */
> > +		mod_timer(&data->timer, jiffies + msecs_to_jiffies(50));
> 
> I do not think you need to do this: your ISR does "mod_timer" which
> means that the timer expiration gets extended every time there is
> interrupt, so as long as the button is pressed the timer will not run.
> So I'd just report the button as released here and be done with it.
Will fix.

> > +
> > +	np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
> > +	if (!np) {
> > +		dev_err(&pdev->dev, "pmc node not found\n");
> > +		return -EINVAL;
> > +	}
> 
> Hmm, why are we looking up another device? What is it is not there yet?
> Can we have all resources contained in this device DT description?

This driver uses registers in the power management controller. It didn't
seem right to declare the memory space for this device as well as the PM
controller, but I don't think there is any reason why it couldn't - just
seemed a bit backward to me.

> > +	data->pmc_base = of_iomap(np, 0);
> > +	if (!data->pmc_base) {
> > +		dev_err(&pdev->dev, "unable to map pmc memory\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	np = pdev->dev.of_node;
> > +	if (!np) {
> > +		dev_err(&pdev->dev, "devicenode not found\n");
> 
> Your error handling is still incomplete, you need to unmap the memory
> you just mapped above.
Will do.
> 
> I happened to peek at other vt8500 drivers and the lack of proper error
> handling and absence of remove() methods is a common theme among them.
Will put this on my list of things to look into. Thanks for pointing it
out.
> 
> > +
> > +	data->kpad_power->evbit[0] = BIT_MASK(EV_KEY);
> > +	set_bit(data->keycode, data->kpad_power->keybit);
> 
> Make it:
> 
> 	input_set_capability(data->kpad_power, EV_KEY, data->keycode);
OK.
> 
> > +
> > +	data->kpad_power->name = "wmt_power_keypad";
> > +	data->kpad_power->phys = "wmt_power_keypad";
> 
> You can have more "human" name in name field, you do not have to have
> underscores. Also if you want to use phys it is common to have it in
> form of "<parent device>/input0" so something like "vt8500-pmic/input0".
Thanks.
> 
> > +	data->kpad_power->keycode = &data->keycode;
> > +	data->kpad_power->keycodesize = sizeof(unsigned int);
> > +	data->kpad_power->keycodemax = 1;
> > +
> > +	err = input_register_device(data->kpad_power);
> > +	if (err < 0) {
> > +		dev_err(&pdev->dev, "failed to register input device\n");
> > +		goto cleanup_input;
> > +	}
> > +
> 
> I'd recommend registering input device after you request irq as it
> simplifies error path (it is OK for ISR to use allocated but not
> registered input device).
Sounds good.
> 
> > +
> > +static int vt8500_pwr_kpad_remove(struct platform_device *pdev)
> > +
> > +{
> > +	struct kpad_pwr_data *data = platform_get_drvdata(pdev);
> > +
> > +	free_irq(data->irq, data);
> > +	del_timer(&data->timer);
> 
> This should be del_timer_sync().
OK.
> 
> > +	input_unregister_device(data->kpad_power);
> > +	input_free_device(data->kpad_power);
> 
> input_free_device() after input_unregister_device() will result in
> double-free. The rule is use input_free_device() if device has not been
> registered, otherwise use input_unregister_device().
That seems a little unintuitive given the functions seemed to be paired.
Will fix. Thanks.
> 
> You also need to unmap the mapped region.
Will do.



Regards
Tony P

^ permalink raw reply

* backlight_register_device can oops if name is null ?
From: devendra.aaru @ 2012-12-31 21:04 UTC (permalink / raw)
  To: linux-fbdev

Hello,

while reading through the backlight_register_device function, there
seems to be a problem if the new object name is null, the pr_debug
print goes and dereferences a null pointer causing an oops,

the print should be removed or the check must be placed to ensure that
name is not null,

any ideas?

^ permalink raw reply

* [PATCH Resend] ARM: pxa27x: fix ac97 controller warm reset code
From: Mike Dunn @ 2012-12-31 21:04 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50E1613B.9040403@compulab.co.il>

On 12/31/2012 01:56 AM, Igor Grinberg wrote:
> On 12/28/12 23:06, Mike Dunn wrote:


[..]


>>
>>  static unsigned long ac97_reset_config[] = {
>> -	GPIO113_GPIO,
>> +	MFP_CFG_OUT(GPIO113, AF0, DRIVE_HIGH),
>>  	GPIO113_AC97_nRESET,
>> -	GPIO95_GPIO,
>> +	MFP_CFG_OUT(GPIO95, AF0, DRIVE_HIGH),
> 
> It was always discouraged to code the above directly.


Had a funny feeling about that when I coded it...  I should have heeded the
feeling instead of being hasty.


> How about one of the below:
> 1)
> GPIO113_GPIO | MFP_PULL_HIGH,
> GPIO95_GPIO  | MFP_PULL_HIGH,
> 
> or
> 
> 2) introduce something like:
> GPIO113_AC97_nRESET_GPIO_HIGH
> GPIO95_AC97_nRESET_GPIO_HIGH
> in the mfp-pxa27x.h file and use them in the structure above.


OK, will implement your suggestion and resubmit.  To me, your first option seems
clearer to the casual reader.

Thanks Igor,
Mike

^ permalink raw reply

* Re: [Qemu-devel] [PATCH 1/2] linux-user: Add setsockopt(SO_ATTACH_FILTER)
From: Peter Maydell @ 2012-12-31 20:56 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Riku Voipio, qemu-devel
In-Reply-To: <1356982680-12436-2-git-send-email-laurent@vivier.eu>

On 31 December 2012 19:37, Laurent Vivier <laurent@vivier.eu> wrote:
> This is needed to be able to run dhclient.
>
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/syscall.c      |   34 +++++++++++++++++++++++++++++++++-
>  linux-user/syscall_defs.h |   12 ++++++++++++
>  2 files changed, 45 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index e99adab..000b640 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -98,6 +98,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
>  #include <linux/fb.h>
>  #include <linux/vt.h>
>  #include <linux/dm-ioctl.h>
> +#include <linux/filter.h>
>  #include "linux_loop.h"
>  #include "cpu-uname.h"
>
> @@ -1491,6 +1492,38 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
>          break;
>      case TARGET_SOL_SOCKET:
>          switch (optname) {
> +        case TARGET_SO_ATTACH_FILTER: {

This brace should go on a line of its own (lined up with the 'c' in case) IMHO.

> +                struct target_sock_fprog *tfprog;
> +                struct target_sock_filter *tfilter;
> +                struct sock_fprog fprog;
> +                struct sock_filter *filter;
> +                int i;
> +
> +                if (optlen != sizeof(*tfprog))
> +                    return -TARGET_EINVAL;

QEMU style requires braces on this if. You can use checkpatch.pl
to catch this kind of thing.

> +                if (!lock_user_struct(VERIFY_READ, tfprog, optval_addr, 0))
> +                    return -TARGET_EFAULT;
> +                if (!lock_user_struct(VERIFY_READ, tfilter,
> +                                      tswapal(tfprog->filter), 0))
> +                    return -TARGET_EFAULT;

This will fail to unlock tfprog in the failure case.

> +
> +                fprog.len = tswap16(tfprog->len);
> +                filter = alloca(fprog.len * sizeof(*filter));

Not sure an unconstrained-size alloca based on data from
the guest binary is a fantastic idea (though we no doubt
do something similar for some other syscalls).

> +                for (i = 0; i < fprog.len; i ++) {
> +                    filter[i].code = tswap16(tfilter[i].code);
> +                    filter[i].jt = tfilter[i].jt;
> +                    filter[i].jf = tfilter[i].jf;
> +                    filter[i].k = tswap32(tfilter[i].k);
> +                }
> +                fprog.filter = filter;
> +
> +                ret = get_errno(setsockopt(sockfd, SOL_SOCKET,
> +                                SO_ATTACH_FILTER, &fprog, sizeof(fprog)));
> +
> +                unlock_user_struct(tfilter, tfprog->filter, 1);
> +                unlock_user_struct(tfprog, optval_addr, 1);
> +                return ret;
> +        }
>              /* Options with 'int' argument.  */
>          case TARGET_SO_DEBUG:
>                 optname = SO_DEBUG;
> @@ -1548,7 +1581,6 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
>          case TARGET_SO_SNDTIMEO:
>                 optname = SO_SNDTIMEO;
>                 break;
> -            break;

Nice catch, but this is an unrelated change that should go in its own patch.

>          default:
>              goto unimplemented;
>          }

-- PMM

^ permalink raw reply

* [Qemu-devel] [Bug 1094950] [NEW] crash at qemu_iohandler_poll (iohandler.c:124) on macos 10.8.2
From: Christopher Mason @ 2012-12-31 20:46 UTC (permalink / raw)
  To: qemu-devel
In-Reply-To: <20121231204645.26308.5533.malonedeb@soybean.canonical.com>

Public bug reported:

I'm seeing consistent hangs / crashes on MacOS 10.8.2 with 1.3.0.  I've
tried both gcc-4.2 and clang.  I've tried a half a dozen different
images/kernels.

I configured qemu like this:

./configure --disable-sdl --disable-kvm --enable-cocoa --cc=gcc-4.2
--host-cc=gcc-4.2 --enable-debug   --extra-cflags=-g   --extra-
ldflags=-g

And ran it like this:

qemu-system-arm -nographic -M versatilepb -kernel
vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda
debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1
console=ttyAMA0"

With images, kernel, and initrd described here:

http://psellos.com/2012/08/2012.08.qemu-arm-osx.html

And I get:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x000000010142f2d0
0x000000010142f2d0 in ?? ()

(gdb) bt
#0  0x000000010142f2d0 in ?? ()
#1  0x000000010016e209 in qemu_iohandler_poll (readfds=0x10097ca00, writefds=0x10097ca80, xfds=0x10097cb00, ret=4) at iohandler.c:124
#2  0x0000000100172acf in main_loop_wait (nonblocking=0) at main-loop.c:418
#3  0x0000000100207bbf in main_loop () at vl.c:1765
#4  0x000000010020e7b0 in qemu_main (argc=12, argv=0x7fff5fbff360, envp=0x7fff5fbff3c8) at vl.c:3992
#5  0x00000001001d6013 in main (argc=12, argv=0x7fff5fbff360) at ui/cocoa.m:884
(gdb) frame 1
#1  0x000000010016e209 in qemu_iohandler_poll (readfds=0x10097ca00, writefds=0x10097ca80, xfds=0x10097cb00, ret=4) at iohandler.c:124
124	                ioh->fd_read(ioh->opaque);
Current language:  auto; currently c
(gdb) p ioh
$1 = (IOHandlerRecord *) 0x10142f110
(gdb) p *ioh
$2 = {
  fd_read_poll = 0, 
  fd_read = 0x10017212b <sigfd_handler>, 
  fd_write = 0, 
  opaque = 0x3, 
  next = {
    le_next = 0x0, 
    le_prev = 0x105d00bc0
  }, 
  fd = 3, 
  deleted = false
}

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1094950

Title:
  crash at  qemu_iohandler_poll (iohandler.c:124) on macos 10.8.2

Status in QEMU:
  New

Bug description:
  I'm seeing consistent hangs / crashes on MacOS 10.8.2 with 1.3.0.
  I've tried both gcc-4.2 and clang.  I've tried a half a dozen
  different images/kernels.

  I configured qemu like this:

  ./configure --disable-sdl --disable-kvm --enable-cocoa --cc=gcc-4.2
  --host-cc=gcc-4.2 --enable-debug   --extra-cflags=-g   --extra-
  ldflags=-g

  And ran it like this:

  qemu-system-arm -nographic -M versatilepb -kernel
  vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda
  debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1
  console=ttyAMA0"

  With images, kernel, and initrd described here:

  http://psellos.com/2012/08/2012.08.qemu-arm-osx.html

  And I get:

  Program received signal EXC_BAD_ACCESS, Could not access memory.
  Reason: KERN_PROTECTION_FAILURE at address: 0x000000010142f2d0
  0x000000010142f2d0 in ?? ()

  (gdb) bt
  #0  0x000000010142f2d0 in ?? ()
  #1  0x000000010016e209 in qemu_iohandler_poll (readfds=0x10097ca00, writefds=0x10097ca80, xfds=0x10097cb00, ret=4) at iohandler.c:124
  #2  0x0000000100172acf in main_loop_wait (nonblocking=0) at main-loop.c:418
  #3  0x0000000100207bbf in main_loop () at vl.c:1765
  #4  0x000000010020e7b0 in qemu_main (argc=12, argv=0x7fff5fbff360, envp=0x7fff5fbff3c8) at vl.c:3992
  #5  0x00000001001d6013 in main (argc=12, argv=0x7fff5fbff360) at ui/cocoa.m:884
  (gdb) frame 1
  #1  0x000000010016e209 in qemu_iohandler_poll (readfds=0x10097ca00, writefds=0x10097ca80, xfds=0x10097cb00, ret=4) at iohandler.c:124
  124	                ioh->fd_read(ioh->opaque);
  Current language:  auto; currently c
  (gdb) p ioh
  $1 = (IOHandlerRecord *) 0x10142f110
  (gdb) p *ioh
  $2 = {
    fd_read_poll = 0, 
    fd_read = 0x10017212b <sigfd_handler>, 
    fd_write = 0, 
    opaque = 0x3, 
    next = {
      le_next = 0x0, 
      le_prev = 0x105d00bc0
    }, 
    fd = 3, 
    deleted = false
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1094950/+subscriptions

^ permalink raw reply

* [PATCH] Access control in Xen privcmd_ioctl_mmap
From: Tamas Lengyel @ 2012-12-31 20:44 UTC (permalink / raw)
  To: konrad.wilk, jeremy; +Cc: Daniel De Graaf, xen-devel, linux-kernel

In the privcmd Linux driver two checks in the functions
privcmd_ioctl_mmap and privcmd_ioctl_mmap_batch are not needed as they
are trying to enforce hypervisor-level access control.  They should be
removed as they break secondary control domains when performing dom0
disaggregation. Xen itself provides adequate security controls around
these hypercalls and these checks prevent those controls from
functioning as intended.

The patch applies to the stable Linux 3.7.1 kernel.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: xen-devel@lists.xensource.com
Cc: linux-kernel@vger.kernel.org
---
 drivers/xen/privcmd.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c
index 71f5c45..adaa260 100644
--- a/drivers/xen/privcmd.c
+++ b/drivers/xen/privcmd.c
@@ -196,9 +196,6 @@ static long privcmd_ioctl_mmap(void __user *udata)
        LIST_HEAD(pagelist);
        struct mmap_mfn_state state;

-       if (!xen_initial_domain())
-               return -EPERM;
-
        if (copy_from_user(&mmapcmd, udata, sizeof(mmapcmd)))
                return -EFAULT;

@@ -316,9 +313,6 @@ static long privcmd_ioctl_mmap_batch(void __user
*udata, int version)
        int *err_array = NULL;
        struct mmap_batch_state state;

-       if (!xen_initial_domain())
-               return -EPERM;
-
        switch (version) {
        case 1:
                if (copy_from_user(&m, udata, sizeof(struct privcmd_mmapbatch)))

^ permalink raw reply related

* Re: [PATCH] [media] blackfin Kconfig: select is evil; use, instead depends on
From: Mauro Carvalho Chehab @ 2012-12-31 20:41 UTC (permalink / raw)
  To: Scott Jiang; +Cc: Linux Media Mailing List
In-Reply-To: <CAHG8p1A2VS8iHsb3PxhVh_CV9bXoob6BXcRNUwLudTgkhPY1Pw@mail.gmail.com>

Em Mon, 31 Dec 2012 17:41:25 +0800
Scott Jiang <scott.jiang.linux@gmail.com> escreveu:

> 2012/12/28 Mauro Carvalho Chehab <mchehab@redhat.com>:
> > Select is evil as it has issues with dependencies. Better to convert
> > it to use depends on.
> >
> > That fixes a breakage with out-of-tree compilation of the media
> > tree.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> > ---
> >  drivers/media/platform/blackfin/Kconfig | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/blackfin/Kconfig b/drivers/media/platform/blackfin/Kconfig
> > index 519990e..cc23997 100644
> > --- a/drivers/media/platform/blackfin/Kconfig
> > +++ b/drivers/media/platform/blackfin/Kconfig
> > @@ -2,7 +2,6 @@ config VIDEO_BLACKFIN_CAPTURE
> >         tristate "Blackfin Video Capture Driver"
> >         depends on VIDEO_V4L2 && BLACKFIN && I2C
> >         select VIDEOBUF2_DMA_CONTIG
> > -       select VIDEO_BLACKFIN_PPI
> >         help
> >           V4L2 bridge driver for Blackfin video capture device.
> >           Choose PPI or EPPI as its interface.
> > @@ -12,3 +11,5 @@ config VIDEO_BLACKFIN_CAPTURE
> >
> >  config VIDEO_BLACKFIN_PPI
> >         tristate
> > +       depends on VIDEO_BLACKFIN_CAPTURE
> > +       default VIDEO_BLACKFIN_CAPTURE
> > --
> 
> There are other drivers select this module.
> 
> config VIDEO_BLACKFIN_DISPLAY
>         tristate "Blackfin Video Display Driver"
>         depends on VIDEO_V4L2 && BLACKFIN && I2C
>         select VIDEOBUF2_DMA_CONTIG
>         select VIDEO_BLACKFIN_PPI
> 
> So should I move all other drivers to the depend on list?

Hmm... I didn't notice.

Yes, using depends on generally better, as it warrants that all
dependencies are properly parsed.

> 
> Scott


-- 

Cheers,
Mauro

^ permalink raw reply

* [Qemu-devel] qemu-ga command listing
From: Eric Blake @ 2012-12-31 20:41 UTC (permalink / raw)
  To: qemu-devel@nongnu.org

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

Is there a guest-agent command for querying the list of available
commands for a given guest agent?  If not, should there be?  In other
words, I'm looking for the counterpart to QMP {"execute":"query-commands"}.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]

^ permalink raw reply

* [PATCH v2] input: vt8500: Add power button keypad driver
From: Dmitry Torokhov @ 2012-12-31 20:37 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1356919499-9654-1-git-send-email-linux@prisktech.co.nz>

Hi Tony,

On Mon, Dec 31, 2012 at 03:04:59PM +1300, Tony Prisk wrote:
> This patch adds support for the Power Button keypad found on
> Wondermedia netbooks/tablets.
> 
> Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> ---
> v2:
> Remove devicetree binding for keycode
> Add dependency on OF in Kconfig
> Move static variables in a struct
> Remove redundant inline modifier from kpad_power_timeout()
> Remove unneccessary checks against power_button_pressed. Drop variable.
> Cleanup the fail path code and add a .remove function.
> Change the button behaviour so that a key-released event is only generated once
> the key is released, not after timeout.
> *Changes tested on WM8650 tablet.


Thank you for making the requested changes, unfortunately there is some
more...

> 
>  .../bindings/input/vt8500-power-keypad.txt         |   15 ++
>  drivers/input/keyboard/Kconfig                     |   10 +
>  drivers/input/keyboard/Makefile                    |    1 +
>  drivers/input/keyboard/wmt_power_keypad.c          |  198 ++++++++++++++++++++
>  4 files changed, 224 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
>  create mode 100644 drivers/input/keyboard/wmt_power_keypad.c
> 
> diff --git a/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
> new file mode 100644
> index 0000000..63f170b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/vt8500-power-keypad.txt
> @@ -0,0 +1,15 @@
> +* Wondermedia Power Keypad device tree bindings
> +
> +Wondermedia SoCs have a single irq-driven power button attached to
> +the power management controller.
> +
> +Required SoC Specific Properties:
> +- compatible: should be one of the following
> +   - "wm,power-keypad": For all Wondermedia 8xxx-series SoCs.
> +- interrupts: should be the power management controller wakeup interrupt.
> +
> +Example:
> +	powerkey: pwrkey at 0 {
> +		compatible = "wm,power-keypad";
> +		interrupts = <22>;
> +	};
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 5a240c6..bb1e04f 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -595,6 +595,16 @@ config KEYBOARD_TWL4030
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called twl4030_keypad.
>  
> +config KEYBOARD_WMT_POWER_KEYPAD
> +	tristate "Wondermedia Power keypad support"
> +	depends on (OF && ARCH_VT8500)
> +	help
> +	  Say Y here to enable support for the power button keypad
> +	  on Wondermedia 8xxx-series SoCs.
> +
> +	  To compile this driver as a module, choose M here: the
> +	  module will be called wmt_power_keypad.
> +
>  config KEYBOARD_XTKBD
>  	tristate "XT keyboard"
>  	select SERIO
> diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile
> index 44e7600..eea31af 100644
> --- a/drivers/input/keyboard/Makefile
> +++ b/drivers/input/keyboard/Makefile
> @@ -52,5 +52,6 @@ obj-$(CONFIG_KEYBOARD_TC3589X)		+= tc3589x-keypad.o
>  obj-$(CONFIG_KEYBOARD_TEGRA)		+= tegra-kbc.o
>  obj-$(CONFIG_KEYBOARD_TNETV107X)	+= tnetv107x-keypad.o
>  obj-$(CONFIG_KEYBOARD_TWL4030)		+= twl4030_keypad.o
> +obj-$(CONFIG_KEYBOARD_WMT_POWER_KEYPAD)	+= wmt_power_keypad.o
>  obj-$(CONFIG_KEYBOARD_XTKBD)		+= xtkbd.o
>  obj-$(CONFIG_KEYBOARD_W90P910)		+= w90p910_keypad.o
> diff --git a/drivers/input/keyboard/wmt_power_keypad.c b/drivers/input/keyboard/wmt_power_keypad.c
> new file mode 100644
> index 0000000..f3b24d8
> --- /dev/null
> +++ b/drivers/input/keyboard/wmt_power_keypad.c
> @@ -0,0 +1,198 @@
> +/* Wondermedia Power Keypad
> + *
> + * Copyright (C) 2012 Tony Prisk <linux@prisktech.co.nz>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/input.h>
> +#include <linux/interrupt.h>
> +#include <linux/platform_device.h>
> +#include <linux/bitops.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_device.h>
> +
> +struct kpad_pwr_data {
> +	struct input_dev	*kpad_power;
> +	void __iomem		*pmc_base;
> +	int			irq;
> +	struct timer_list	timer;
> +	spinlock_t		lock;
> +	unsigned int		keycode;
> +};
> +
> +static void kpad_power_timeout(unsigned long fcontext)
> +{
> +	struct kpad_pwr_data *data = (struct kpad_pwr_data *)fcontext;
> +	u32 status;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&data->lock, flags);
> +
> +	status = readl(data->pmc_base + 0x14);
> +	if (status & BIT(14)) {
> +		/* Button isn't release so check again in 50ms */
> +		mod_timer(&data->timer, jiffies + msecs_to_jiffies(50));

I do not think you need to do this: your ISR does "mod_timer" which
means that the timer expiration gets extended every time there is
interrupt, so as long as the button is pressed the timer will not run.
So I'd just report the button as released here and be done with it.

> +	} else {
> +		/* Send a button released message */
> +		input_report_key(data->kpad_power, data->keycode, 0);
> +		input_sync(data->kpad_power);
> +	}
> +
> +	spin_unlock_irqrestore(&data->lock, flags);
> +}
> +
> +static irqreturn_t kpad_power_isr(int irq_num, void *priv)
> +{
> +	struct kpad_pwr_data *data = priv;
> +	u32 status;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&data->lock, flags);
> +
> +	status = readl(data->pmc_base + 0x14);
> +	writel(status, data->pmc_base + 0x14);
> +
> +	if (status & BIT(14)) {
> +		input_report_key(data->kpad_power, data->keycode, 1);
> +		input_sync(data->kpad_power);
> +		mod_timer(&data->timer, jiffies + msecs_to_jiffies(250));
> +	}
> +
> +	spin_unlock_irqrestore(&data->lock, flags);
> +
> +	return IRQ_HANDLED;
> +}
> +
> +static int vt8500_pwr_kpad_probe(struct platform_device *pdev)
> +{
> +	struct device_node *np;
> +	struct kpad_pwr_data *data;
> +	u32 status;
> +	int err;
> +
> +	np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
> +	if (!np) {
> +		dev_err(&pdev->dev, "pmc node not found\n");
> +		return -EINVAL;
> +	}

Hmm, why are we looking up another device? What is it is not there yet?
Can we have all resources contained in this device DT description?

> +
> +	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> +	if (!data) {
> +		dev_err(&pdev->dev, "unable to allocate private data\n");
> +		return -ENOMEM;
> +	}
> +
> +	data->keycode = KEY_POWER;
> +	spin_lock_init(&data->lock);
> +
> +	data->pmc_base = of_iomap(np, 0);
> +	if (!data->pmc_base) {
> +		dev_err(&pdev->dev, "unable to map pmc memory\n");
> +		return -ENOMEM;
> +	}
> +
> +	np = pdev->dev.of_node;
> +	if (!np) {
> +		dev_err(&pdev->dev, "devicenode not found\n");

Your error handling is still incomplete, you need to unmap the memory
you just mapped above.

I happened to peek at other vt8500 drivers and the lack of proper error
handling and absence of remove() methods is a common theme among them.


> +		return -ENODEV;
> +	}
> +
> +	/* set power button to soft-power */
> +	status = readl(data->pmc_base + 0x54);
> +	writel(status | 1, data->pmc_base + 0x54);
> +
> +	/* clear any pending interrupts */
> +	status = readl(data->pmc_base + 0x14);
> +	writel(status, data->pmc_base + 0x14);
> +
> +	data->kpad_power = input_allocate_device();
> +	if (!data->kpad_power) {
> +		dev_err(&pdev->dev, "failed to allocate input device\n");
> +		return -ENOMEM;
> +	}
> +
> +	data->kpad_power->evbit[0] = BIT_MASK(EV_KEY);
> +	set_bit(data->keycode, data->kpad_power->keybit);

Make it:

	input_set_capability(data->kpad_power, EV_KEY, data->keycode);

> +
> +	data->kpad_power->name = "wmt_power_keypad";
> +	data->kpad_power->phys = "wmt_power_keypad";

You can have more "human" name in name field, you do not have to have
underscores. Also if you want to use phys it is common to have it in
form of "<parent device>/input0" so something like "vt8500-pmic/input0".

> +	data->kpad_power->keycode = &data->keycode;
> +	data->kpad_power->keycodesize = sizeof(unsigned int);
> +	data->kpad_power->keycodemax = 1;
> +
> +	err = input_register_device(data->kpad_power);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to register input device\n");
> +		goto cleanup_input;
> +	}
> +

I'd recommend registering input device after you request irq as it
simplifies error path (it is OK for ISR to use allocated but not
registered input device).

> +	setup_timer(&data->timer, kpad_power_timeout, (unsigned long)data);
> +
> +	data->irq = irq_of_parse_and_map(np, 0);
> +	err = request_irq(data->irq, &kpad_power_isr, 0, "pwrbtn", data);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to request irq\n");
> +		goto cleanup_irq;
> +	}
> +
> +	platform_set_drvdata(pdev, data);
> +
> +	return 0;
> +
> +cleanup_irq:
> +	del_timer(&data->timer);
> +cleanup_input:
> +	input_free_device(data->kpad_power);
> +
> +	return err;
> +}
> +
> +static int vt8500_pwr_kpad_remove(struct platform_device *pdev)
> +
> +{
> +	struct kpad_pwr_data *data = platform_get_drvdata(pdev);
> +
> +	free_irq(data->irq, data);
> +	del_timer(&data->timer);

This should be del_timer_sync().

> +	input_unregister_device(data->kpad_power);
> +	input_free_device(data->kpad_power);

input_free_device() after input_unregister_device() will result in
double-free. The rule is use input_free_device() if device has not been
registered, otherwise use input_unregister_device().

You also need to unmap the mapped region.

> +
> +	return 0;
> +}
> +
> +
> +static struct of_device_id vt8500_pwr_kpad_dt_ids[] = {
> +	{ .compatible = "wm,power-keypad" },
> +	{ /* Sentinel */ },
> +};
> +
> +static struct platform_driver vt8500_pwr_kpad_driver = {
> +	.probe		= vt8500_pwr_kpad_probe,
> +	.remove		= vt8500_pwr_kpad_remove,
> +	.driver		= {
> +		.name	= "wmt-power-keypad",
> +		.owner	= THIS_MODULE,
> +		.of_match_table = vt8500_pwr_kpad_dt_ids,
> +	},
> +};
> +
> +module_platform_driver(vt8500_pwr_kpad_driver);
> +
> +MODULE_DESCRIPTION("Wondermedia Power Keypad Driver");
> +MODULE_AUTHOR("Tony Prisk <linux@prisktech.co.nz>");
> +MODULE_LICENSE("GPL v2");
> +MODULE_DEVICE_TABLE(of, vt8500_pwr_kpad_dt_ids);
> -- 
> 1.7.9.5
> 

Thanks.

-- 
Dmitry

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.