From: H Hartley Sweeten Date: Wed, 9 Jan 2013 20:27:48 +0000 (-0700) Subject: staging: comedi: comedi_buf: factor out common comedi_buf_write_alloc_* code X-Git-Tag: v3.9-rc1~127^2~438 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8f76e909b8cc6696071e69cf4be07714c95bcb4;p=pandora-kernel.git staging: comedi: comedi_buf: factor out common comedi_buf_write_alloc_* code The only difference between comedi_buf_write_alloc() and the *_strict() version is that the *_strict() one will only allocate the chunk if it can completely fulfill the request. Factor out the common code and add a flag parameter to indicate the 'strict' usage. Change the exported functions so they are just wrappers around the common function. Cleanup the common function a bit and use the comedi_buf_write_n_available() helper to determine the number of bytes available. comedi_buf_write_n_available() is not used outside this module so make it static. Since the only caller is __comedi_buf_write_alloc(), which will always have a valid async pointer and already has a memory barrier, we can remove the unnecessary (async == NULL) test as well as the smp_mb(). Also, the rounding of the sample size can be removed since the caller does not need it. Signed-off-by: H Hartley Sweeten Signed-off-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed