public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: devicetree@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	Ryder Lee <ryder.lee@mediatek.com>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	"open list:MEDIATEK MT76 WIRELESS LAN DRIVER"
	<linux-wireless@vger.kernel.org>,
	"open list:ARM/Mediatek SoC support"
	<linux-kernel@vger.kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	"open list:MIPS" <linux-mips@vger.kernel.org>
Subject: Re: [PATCH 3/3] wifi: mt76: remove mt76_get_of_data_from_mtd
Date: Mon, 27 Apr 2026 21:02:56 +0100	[thread overview]
Message-ID: <20260427-safeguard-unthawed-cfb87dc55a32@spud> (raw)
In-Reply-To: <CAKxU2N-mhrhjDEc2MnOvDZC5PpMzj=vRgMemNK4qSQzNQ-=BPQ@mail.gmail.com>

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

On Mon, Apr 27, 2026 at 12:17:04PM -0700, Rosen Penev wrote:
> On Mon, Apr 27, 2026 at 12:09 PM Conor Dooley <conor@kernel.org> wrote:
> >
> > On Sun, Apr 26, 2026 at 08:44:27PM -0700, Rosen Penev wrote:
> > > mt76_get_of_data_from_mtd has been replaced by
> > > mt76_get_of_data_from_nvmem in all usages.
> >
> > All users in the kernel, but what about other sources of devicetrees?
> > Those built into firmware etc? Are there none of those too?
> I'm actively removing those: https://github.com/openwrt/openwrt/pull/23113
> 
> Anyway, irrelevant here.

Hardly, you can't break backwards compatibility with old devicetrees.
Removing known users from the kernel is one step in that process, but if
there's devicetrees in other places those cunt too!

With the moving pieces in this patchset alone it's problematic to move
this fast, since you're changing the dts user in the same series as
removing driver support (AFIACT), which means that neither netdev nor
the platform tree will work with their portion applied.

> >
> > Conor.
> >
> > >
> > > Remove it to prevent people from using the deprecated
> > > mediatek,mtd-eeprom binding.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > >  drivers/net/wireless/mediatek/mt76/eeprom.c   | 87 -------------------
> > >  drivers/net/wireless/mediatek/mt76/mt76.h     |  1 -
> > >  .../wireless/mediatek/mt76/mt7915/eeprom.c    |  4 -
> > >  3 files changed, 92 deletions(-)
> > >
> > > diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
> > > index afdb73661866..092804323d81 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/eeprom.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
> > > @@ -35,89 +35,6 @@ static int mt76_get_of_eeprom_data(struct mt76_dev *dev, void *eep, int len)
> > >       return 0;
> > >  }
> > >
> > > -int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len)
> > > -{
> > > -#ifdef CONFIG_MTD
> > > -     struct device_node *np = dev->dev->of_node;
> > > -     struct mtd_info *mtd;
> > > -     const __be32 *list;
> > > -     const char *part;
> > > -     phandle phandle;
> > > -     size_t retlen;
> > > -     int size;
> > > -     int ret;
> > > -
> > > -     list = of_get_property(np, "mediatek,mtd-eeprom", &size);
> > > -     if (!list)
> > > -             return -ENOENT;
> > > -
> > > -     phandle = be32_to_cpup(list++);
> > > -     if (!phandle)
> > > -             return -ENOENT;
> > > -
> > > -     np = of_find_node_by_phandle(phandle);
> > > -     if (!np)
> > > -             return -EINVAL;
> > > -
> > > -     part = of_get_property(np, "label", NULL);
> > > -     if (!part)
> > > -             part = np->name;
> > > -
> > > -     mtd = get_mtd_device_nm(part);
> > > -     if (IS_ERR(mtd)) {
> > > -             ret =  PTR_ERR(mtd);
> > > -             goto out_put_node;
> > > -     }
> > > -
> > > -     if (size <= sizeof(*list)) {
> > > -             ret = -EINVAL;
> > > -             goto out_put_node;
> > > -     }
> > > -
> > > -     offset += be32_to_cpup(list);
> > > -     ret = mtd_read(mtd, offset, len, &retlen, eep);
> > > -     put_mtd_device(mtd);
> > > -     if (mtd_is_bitflip(ret))
> > > -             ret = 0;
> > > -     if (ret) {
> > > -             dev_err(dev->dev, "reading EEPROM from mtd %s failed: %i\n",
> > > -                     part, ret);
> > > -             goto out_put_node;
> > > -     }
> > > -
> > > -     if (retlen < len) {
> > > -             ret = -EINVAL;
> > > -             goto out_put_node;
> > > -     }
> > > -
> > > -     if (of_property_read_bool(dev->dev->of_node, "big-endian")) {
> > > -             u8 *data = (u8 *)eep;
> > > -             int i;
> > > -
> > > -             /* convert eeprom data in Little Endian */
> > > -             for (i = 0; i < round_down(len, 2); i += 2)
> > > -                     put_unaligned_le16(get_unaligned_be16(&data[i]),
> > > -                                        &data[i]);
> > > -     }
> > > -
> > > -#ifdef CONFIG_NL80211_TESTMODE
> > > -     dev->test_mtd.name = devm_kstrdup(dev->dev, part, GFP_KERNEL);
> > > -     if (!dev->test_mtd.name) {
> > > -             ret = -ENOMEM;
> > > -             goto out_put_node;
> > > -     }
> > > -     dev->test_mtd.offset = offset;
> > > -#endif
> > > -
> > > -out_put_node:
> > > -     of_node_put(np);
> > > -     return ret;
> > > -#else
> > > -     return -ENOENT;
> > > -#endif
> > > -}
> > > -EXPORT_SYMBOL_GPL(mt76_get_of_data_from_mtd);
> > > -
> > >  int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
> > >                               const char *cell_name, int len)
> > >  {
> > > @@ -163,10 +80,6 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len)
> > >       if (!ret)
> > >               return 0;
> > >
> > > -     ret = mt76_get_of_data_from_mtd(dev, eep, 0, len);
> > > -     if (!ret)
> > > -             return 0;
> > > -
> > >       return mt76_get_of_data_from_nvmem(dev, eep, "eeprom", len);
> > >  }
> > >
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > index 527bef97e122..f447ecac664d 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> > > @@ -1339,7 +1339,6 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str,
> > >
> > >  int mt76_eeprom_init(struct mt76_dev *dev, int len);
> > >  int mt76_eeprom_override(struct mt76_phy *phy);
> > > -int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len);
> > >  int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep,
> > >                               const char *cell_name, int len);
> > >
> > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> > > index eb92cbf1a284..c24e1276700b 100644
> > > --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> > > +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
> > > @@ -29,10 +29,6 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev)
> > >
> > >       offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2;
> > >
> > > -     ret = mt76_get_of_data_from_mtd(mdev, dev->cal, offs, size);
> > > -     if (!ret)
> > > -             return ret;
> > > -
> > >       ret = mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", size);
> > >       if (!ret)
> > >               return ret;
> > > --
> > > 2.54.0
> > >

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-04-27 20:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27  3:44 [PATCH 0/3] wifi: mt76: remove mediatek,mtd-eeprom Rosen Penev
2026-04-27  3:44 ` [PATCH 1/3] MIPS: dts: ralink: gardena_smart_gateway_mt7688: use nvmem for EEPROM Rosen Penev
2026-04-27  3:44 ` [PATCH 2/3] dt-bindings: net: wireless: mt76: remove mediatek,mtd-eeprom Rosen Penev
2026-04-28  7:33   ` Krzysztof Kozlowski
2026-04-27  3:44 ` [PATCH 3/3] wifi: mt76: remove mt76_get_of_data_from_mtd Rosen Penev
2026-04-27 19:09   ` Conor Dooley
2026-04-27 19:17     ` Rosen Penev
2026-04-27 20:02       ` Conor Dooley [this message]
2026-04-27 20:04         ` Conor Dooley
2026-04-28  7:32   ` Krzysztof Kozlowski

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=20260427-safeguard-unthawed-cfb87dc55a32@spud \
    --to=conor@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=robh@kernel.org \
    --cc=rosenp@gmail.com \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    --cc=tsbogend@alpha.franken.de \
    /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