All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Tom Rini" <trini@konsulko.com>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de,
	devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node
Date: Mon, 13 Jun 2022 16:15:34 +0200	[thread overview]
Message-ID: <ad084c13-55fc-8506-f768-49a0c6ae4f7f@gmail.com> (raw)
In-Reply-To: <20220613160411.48b07515@xps-13>

On 13.06.2022 16:04, Miquel Raynal wrote:
>> @@ -1154,6 +1154,34 @@ int __get_mtd_device(struct mtd_info *mtd)
>>   }
>>   EXPORT_SYMBOL_GPL(__get_mtd_device);
>>   
>> +/**
>> + * of_get_mtd_device_by_node - obtain an MTD device associated with a given node
>> + *
>> + * @np: device tree node
>> + */
>> +struct mtd_info *of_get_mtd_device_by_node(struct device_node *np)
> 
> Shall we try to use a more of-agnostic syntax or is it too complex here?

I need some extra hint, please. This is how many similar functions look
like:

$ grep -E -r "(get|find).*_by_node" ./include/*
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
./include/linux/usb/phy.h:extern struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/usb/phy.h:static inline struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/extcon.h:struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);
./include/linux/extcon.h:static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
./include/linux/of_net.h:extern struct net_device *of_find_net_device_by_node(struct device_node *np);
./include/linux/of_net.h:static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
./include/linux/devfreq.h:struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
./include/linux/devfreq.h:static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
./include/linux/of_platform.h:extern struct platform_device *of_find_device_by_node(struct device_node *np);
./include/linux/of_platform.h:static inline struct platform_device *of_find_device_by_node(struct device_node *np)
./include/linux/backlight.h:struct backlight_device *of_find_backlight_by_node(struct device_node *node);
./include/linux/backlight.h:of_find_backlight_by_node(struct device_node *node)
./include/linux/i2c.h:struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node)


>> +{
>> +	struct mtd_info *mtd = NULL;
>> +	struct mtd_info *tmp;
>> +	int err;
>> +
>> +	mutex_lock(&mtd_table_mutex);
>> +
>> +	err = -ENODEV;
>> +	mtd_for_each_device(tmp) {
>> +		if (mtd_get_of_node(tmp) == np) {
>> +			mtd = tmp;
>> +			err = __get_mtd_device(mtd);
>> +			break;
>> +		}
>> +	}
>> +
>> +	mutex_unlock(&mtd_table_mutex);
>> +
>> +	return err ? ERR_PTR(err) : mtd;
>> +}
>> +EXPORT_SYMBOL_GPL(of_get_mtd_device_by_node);
>> +
>>   /**
>>    *	get_mtd_device_nm - obtain a validated handle for an MTD device by
>>    *	device name


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Tom Rini" <trini@konsulko.com>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de,
	devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node
Date: Mon, 13 Jun 2022 16:15:34 +0200	[thread overview]
Message-ID: <ad084c13-55fc-8506-f768-49a0c6ae4f7f@gmail.com> (raw)
In-Reply-To: <20220613160411.48b07515@xps-13>

On 13.06.2022 16:04, Miquel Raynal wrote:
>> @@ -1154,6 +1154,34 @@ int __get_mtd_device(struct mtd_info *mtd)
>>   }
>>   EXPORT_SYMBOL_GPL(__get_mtd_device);
>>   
>> +/**
>> + * of_get_mtd_device_by_node - obtain an MTD device associated with a given node
>> + *
>> + * @np: device tree node
>> + */
>> +struct mtd_info *of_get_mtd_device_by_node(struct device_node *np)
> 
> Shall we try to use a more of-agnostic syntax or is it too complex here?

I need some extra hint, please. This is how many similar functions look
like:

$ grep -E -r "(get|find).*_by_node" ./include/*
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
./include/linux/usb/phy.h:extern struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/usb/phy.h:static inline struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/extcon.h:struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);
./include/linux/extcon.h:static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
./include/linux/of_net.h:extern struct net_device *of_find_net_device_by_node(struct device_node *np);
./include/linux/of_net.h:static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
./include/linux/devfreq.h:struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
./include/linux/devfreq.h:static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
./include/linux/of_platform.h:extern struct platform_device *of_find_device_by_node(struct device_node *np);
./include/linux/of_platform.h:static inline struct platform_device *of_find_device_by_node(struct device_node *np)
./include/linux/backlight.h:struct backlight_device *of_find_backlight_by_node(struct device_node *node);
./include/linux/backlight.h:of_find_backlight_by_node(struct device_node *node)
./include/linux/i2c.h:struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node)


>> +{
>> +	struct mtd_info *mtd = NULL;
>> +	struct mtd_info *tmp;
>> +	int err;
>> +
>> +	mutex_lock(&mtd_table_mutex);
>> +
>> +	err = -ENODEV;
>> +	mtd_for_each_device(tmp) {
>> +		if (mtd_get_of_node(tmp) == np) {
>> +			mtd = tmp;
>> +			err = __get_mtd_device(mtd);
>> +			break;
>> +		}
>> +	}
>> +
>> +	mutex_unlock(&mtd_table_mutex);
>> +
>> +	return err ? ERR_PTR(err) : mtd;
>> +}
>> +EXPORT_SYMBOL_GPL(of_get_mtd_device_by_node);
>> +
>>   /**
>>    *	get_mtd_device_nm - obtain a validated handle for an MTD device by
>>    *	device name


WARNING: multiple messages have this Message-ID (diff)
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Tom Rini" <trini@konsulko.com>,
	"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
	linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de,
	devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node
Date: Mon, 13 Jun 2022 16:15:34 +0200	[thread overview]
Message-ID: <ad084c13-55fc-8506-f768-49a0c6ae4f7f@gmail.com> (raw)
In-Reply-To: <20220613160411.48b07515@xps-13>

On 13.06.2022 16:04, Miquel Raynal wrote:
>> @@ -1154,6 +1154,34 @@ int __get_mtd_device(struct mtd_info *mtd)
>>   }
>>   EXPORT_SYMBOL_GPL(__get_mtd_device);
>>   
>> +/**
>> + * of_get_mtd_device_by_node - obtain an MTD device associated with a given node
>> + *
>> + * @np: device tree node
>> + */
>> +struct mtd_info *of_get_mtd_device_by_node(struct device_node *np)
> 
> Shall we try to use a more of-agnostic syntax or is it too complex here?

I need some extra hint, please. This is how many similar functions look
like:

$ grep -E -r "(get|find).*_by_node" ./include/*
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
./include/drm/drm_mipi_dsi.h:struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
./include/linux/usb/phy.h:extern struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/usb/phy.h:static inline struct usb_phy *devm_usb_get_phy_by_node(struct device *dev,
./include/linux/extcon.h:struct extcon_dev *extcon_find_edev_by_node(struct device_node *node);
./include/linux/extcon.h:static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node *node)
./include/linux/of_net.h:extern struct net_device *of_find_net_device_by_node(struct device_node *np);
./include/linux/of_net.h:static inline struct net_device *of_find_net_device_by_node(struct device_node *np)
./include/linux/devfreq.h:struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
./include/linux/devfreq.h:static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
./include/linux/of_platform.h:extern struct platform_device *of_find_device_by_node(struct device_node *np);
./include/linux/of_platform.h:static inline struct platform_device *of_find_device_by_node(struct device_node *np)
./include/linux/backlight.h:struct backlight_device *of_find_backlight_by_node(struct device_node *node);
./include/linux/backlight.h:of_find_backlight_by_node(struct device_node *node)
./include/linux/i2c.h:struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node);
./include/linux/i2c.h:static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
./include/linux/i2c.h:static inline struct i2c_adapter *of_get_i2c_adapter_by_node(struct device_node *node)


>> +{
>> +	struct mtd_info *mtd = NULL;
>> +	struct mtd_info *tmp;
>> +	int err;
>> +
>> +	mutex_lock(&mtd_table_mutex);
>> +
>> +	err = -ENODEV;
>> +	mtd_for_each_device(tmp) {
>> +		if (mtd_get_of_node(tmp) == np) {
>> +			mtd = tmp;
>> +			err = __get_mtd_device(mtd);
>> +			break;
>> +		}
>> +	}
>> +
>> +	mutex_unlock(&mtd_table_mutex);
>> +
>> +	return err ? ERR_PTR(err) : mtd;
>> +}
>> +EXPORT_SYMBOL_GPL(of_get_mtd_device_by_node);
>> +
>>   /**
>>    *	get_mtd_device_nm - obtain a validated handle for an MTD device by
>>    *	device name


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-06-13 14:16 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11 20:46 [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node Rafał Miłecki
2022-06-11 20:46 ` Rafał Miłecki
2022-06-11 20:46 ` Rafał Miłecki
2022-06-11 20:46 ` [PATCH V3 2/2] nvmem: add driver handling U-Boot environment variables Rafał Miłecki
2022-06-11 20:46   ` Rafał Miłecki
2022-06-11 20:46   ` Rafał Miłecki
2022-06-14  6:45   ` Ahmad Fatoum
2022-06-14  6:45     ` Ahmad Fatoum
2022-06-14  6:45     ` Ahmad Fatoum
2022-06-15 18:30     ` Rafał Miłecki
2022-06-15 18:30       ` Rafał Miłecki
2022-06-15 18:30       ` Rafał Miłecki
2022-06-14  7:46   ` Sascha Hauer
2022-06-14  7:46     ` Sascha Hauer
2022-06-14  7:46     ` Sascha Hauer
2022-06-14  9:02     ` Miquel Raynal
2022-06-14  9:02       ` Miquel Raynal
2022-06-14  9:02       ` Miquel Raynal
2022-06-13 14:04 ` [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node Miquel Raynal
2022-06-13 14:04   ` Miquel Raynal
2022-06-13 14:04   ` Miquel Raynal
2022-06-13 14:15   ` Rafał Miłecki [this message]
2022-06-13 14:15     ` Rafał Miłecki
2022-06-13 14:15     ` Rafał Miłecki
2022-06-13 14:33     ` Miquel Raynal
2022-06-13 14:33       ` Miquel Raynal
2022-06-13 14:33       ` Miquel Raynal
2022-06-14  6:49 ` Ahmad Fatoum
2022-06-14  6:49   ` Ahmad Fatoum
2022-06-14  6:49   ` Ahmad Fatoum

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=ad084c13-55fc-8506-f768-49a0c6ae4f7f@gmail.com \
    --to=zajec5@gmail.com \
    --cc=a.fatoum@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.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 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.