devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Antoine Tenart <antoine.tenart@free-electrons.com>,
	maxime.ripard@free-electrons.com, pantelis.antoniou@konsulko.com,
	mark.rutland@arm.com, sboyd@codeaurora.org
Cc: thomas.petazzoni@free-electrons.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC PATCH 5/5] of: overlay-mgr: add a detector for headers stored on a ds2431 eeprom over w1
Date: Thu, 27 Oct 2016 11:18:59 +0200	[thread overview]
Message-ID: <dc7221ad-245b-7b72-581f-b5b67d6db86c@gmail.com> (raw)
In-Reply-To: <20161026145756.21689-6-antoine.tenart@free-electrons.com>



On 10/26/2016 04:57 PM, Antoine Tenart wrote:
> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
> ---

Please provide a commit message.

>  drivers/of/overlay-manager/Kconfig | 10 ++++++++++
>  drivers/w1/slaves/w1_ds2431.c      | 39 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+)
>
> diff --git a/drivers/of/overlay-manager/Kconfig b/drivers/of/overlay-manager/Kconfig
> index 1a36613c0c53..ad0a5b8e9e5e 100644
> --- a/drivers/of/overlay-manager/Kconfig
> +++ b/drivers/of/overlay-manager/Kconfig
> @@ -16,4 +16,14 @@ config OF_OVERLAY_MGR_FORMAT_CHIP
>
>  endmenu
>
> +menu "Overlay Manager detectors"
> +
> +config OF_OVERLAY_MGR_DETECTOR_DS2431
> +	bool "Dip header on a DS2431 EEPROM"
> +	depends on W1_SLAVE_DS2431
> +	help
> +	  Enable dip header DS2431 EEPROM support.
> +
> +endmenu
> +
>  endif
> diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c
> index 80572cb63ba8..760325f9a2bd 100644
> --- a/drivers/w1/slaves/w1_ds2431.c
> +++ b/drivers/w1/slaves/w1_ds2431.c
> @@ -15,6 +15,9 @@
>  #include <linux/device.h>
>  #include <linux/types.h>
>  #include <linux/delay.h>
> +#include <linux/slab.h>
> +
> +#include <linux/overlay-manager.h>
>
>  #include "../w1.h"
>  #include "../w1_int.h"
> @@ -280,7 +283,43 @@ static const struct attribute_group *w1_f2d_groups[] = {
>  	NULL,
>  };
>
> +#if IS_ENABLED(CONFIG_OF_OVERLAY_MGR_DETECTOR_DS2431)
> +static int chip_dip_callback(struct w1_slave *sl)
> +{
> +	char **candidates = NULL;
> +	int i, n, err = 0;
> +	u8 *data;
> +
> +	data = kzalloc(OVERLAY_MGR_DIP_MAX_SZ, GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	/* sizeof(struct chip_header) is a mulitple of 8 */
> +	for (i = 0; i < OVERLAY_MGR_DIP_MAX_SZ; i += 8) {
> +		if (w1_f2d_readblock(sl, i, 8, &data[i])) {
> +			err = -EIO;
> +			goto end;
> +		}
> +	}
> +
> +	overlay_mgr_parse(&sl->dev, data, &candidates, &n);
> +	if (!n) {
> +		err = -EINVAL;
> +		goto end;
> +	}
> +
> +	err = overlay_mgr_apply(&sl->dev, candidates, n);
> +
> +end:
> +	kfree(data);
> +	return err;
> +}
> +#endif
> +
>  static struct w1_family_ops w1_f2d_fops = {
> +#if IS_ENABLED(CONFIG_OF_OVERLAY_MGR_DETECTOR_DS2431)
> +	.callback	= chip_dip_callback,
> +#endif
>  	.groups		= w1_f2d_groups,
>  };
>
>

  reply	other threads:[~2016-10-27  9:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 14:57 [RFC PATCH 0/5] Add an overlay manager to handle board capes Antoine Tenart
2016-10-26 14:57 ` [RFC PATCH 1/5] of: introduce the overlay manager Antoine Tenart
     [not found]   ` <20161026145756.21689-2-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-26 16:29     ` Mathieu Poirier
2016-10-26 19:02       ` Thomas Petazzoni
2016-10-27 14:03       ` Antoine Tenart
2016-10-27 14:49         ` Mathieu Poirier
2016-10-27 14:54           ` Antoine Tenart
2016-10-27 15:07     ` Pantelis Antoniou
2016-10-27  9:10   ` Matthias Brugger
2016-10-27 14:56   ` Pantelis Antoniou
     [not found] ` <20161026145756.21689-1-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-26 14:57   ` [RFC PATCH 2/5] of: overlay-mgr: add the CHIP format Antoine Tenart
2016-10-26 14:57   ` [RFC PATCH 3/5] w1: report errors returned by w1_family_notify Antoine Tenart
     [not found]     ` <20161026145756.21689-4-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-26 16:39       ` Mathieu Poirier
2016-10-26 14:57 ` [RFC PATCH 4/5] w1: add a callback to call slave when a new device is connected Antoine Tenart
     [not found]   ` <20161026145756.21689-5-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-10-26 16:42     ` Mathieu Poirier
     [not found]       ` <CANLsYkxfnF9-H9mawt3BWTgy5gjf8Qs3O6iSRGiLQ=8vfYACTQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-26 17:30         ` Antoine Tenart
2016-10-26 14:57 ` [RFC PATCH 5/5] of: overlay-mgr: add a detector for headers stored on a ds2431 eeprom over w1 Antoine Tenart
2016-10-27  9:18   ` Matthias Brugger [this message]
2016-10-27  9:19   ` Matthias Brugger
2016-10-27 13:55     ` Antoine Tenart
2016-10-27 13:41 ` [RFC PATCH 0/5] Add an overlay manager to handle board capes Rob Herring
2016-10-27 14:25   ` Antoine Tenart
     [not found]   ` <CAL_JsqL9yWBj0yYE54XGi87YPGugGAACzr=CuW6dk5kk3EuyCA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-27 15:13     ` Hans de Goede
     [not found]       ` <4ca9db09-e52c-11ec-133b-8f193b9b7174-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-27 17:30         ` Rob Herring
2016-10-27 20:51           ` Hans de Goede

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=dc7221ad-245b-7b72-581f-b5b67d6db86c@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=antoine.tenart@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=sboyd@codeaurora.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /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).