linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 0/8] iio: Refactor __iio_update_buffers()
Date: Wed, 13 May 2015 16:04:43 +0200	[thread overview]
Message-ID: <1431525891-19285-1-git-send-email-lars@metafoo.de> (raw)

__iio_update_buffers() is quite the beast, it does quite a few different
things and has a couple of separate error paths due to this. This series
refactors the function starting with moving the configuration verification
out of the configuration path itself. This means we can verify that the
configuration will be accepted before we make any changes to the device and
don't have to implement rollback functionality. The function is also broken
down into a couple of smaller helper function each which only a single
error path. This should hopefully make it easier to comprehend what is
going on. The last step of the refactoring process is to make sure that we
always leave the device in a sane and consistent state even if we encounter
a fatal error. This allows to potentially recover from the fatal error and
will also make sure that we don't trigger unexpected behavior in drivers.

The main motivation for this series to get __iio_update_buffers() ready for
future extension like the ones that are needed to support DMA buffer
support as well as better support for hardware buffer support.

The last patch in this series is not meant to be applied, but it implements
some simple random error injecting into the various error paths of
__iio_update_buffers(). This was used to test the patch series for
regressions and to make sure that we can indeed recover from fatal errors
now.

- Lars

Lars-Peter Clausen (8):
  iio: Replace printk in __iio_update_buffers with dev_dbg
  iio: __iio_update_buffers: Slightly refactor scan mask memory
    management
  iio: __iio_update_buffers: Perform request_update() only for new
    buffers
  iio: __iio_update_buffers: Update mode before preenable/after
    postdisable
  iio: __iio_update_buffers: Verify configuration before starting to
    apply it
  iio: __iio_update_buffers: Split enable and disable path into helper
    functions
  iio: __iio_update_buffers: Leave device in sane state on error
  DO NOT APPLY! __iio_update_buffers error path testing

 drivers/iio/industrialio-buffer.c | 364 ++++++++++++++++++++++++--------------
 1 file changed, 229 insertions(+), 135 deletions(-)

-- 
1.8.0


             reply	other threads:[~2015-05-13 14:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 14:04 Lars-Peter Clausen [this message]
2015-05-13 14:04 ` [PATCH 1/8] iio: Replace printk in __iio_update_buffers with dev_dbg Lars-Peter Clausen
2015-05-17  8:42   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 2/8] iio: __iio_update_buffers: Slightly refactor scan mask memory management Lars-Peter Clausen
2015-05-17  8:48   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 3/8] iio: __iio_update_buffers: Perform request_update() only for new buffers Lars-Peter Clausen
2015-05-17  9:01   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 4/8] iio: __iio_update_buffers: Update mode before preenable/after postdisable Lars-Peter Clausen
2015-05-17  9:10   ` Jonathan Cameron
2015-05-17 11:38     ` Lars-Peter Clausen
2015-05-17 11:44       ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 5/8] iio: __iio_update_buffers: Verify configuration before starting to apply it Lars-Peter Clausen
2015-05-17  9:14   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 6/8] iio: __iio_update_buffers: Split enable and disable path into helper functions Lars-Peter Clausen
2015-05-17  9:17   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 7/8] iio: __iio_update_buffers: Leave device in sane state on error Lars-Peter Clausen
2015-05-17  9:22   ` Jonathan Cameron
2015-05-13 14:04 ` [PATCH 8/8] DO NOT APPLY! __iio_update_buffers error path testing Lars-Peter Clausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1431525891-19285-1-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).