From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f169.google.com (mail-dy1-f169.google.com [74.125.82.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48811384223 for ; Mon, 18 May 2026 20:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135327; cv=none; b=MuI4q3EvuQO1jP4psmfkWTJPg5EzbpU/98lxljYqHsutT4m6Iud79LF8T47fG+Ydq7REAS61NMsw4LNCSOGZxPc5B8sS1h6xvOW4LMOaK35xs1VGct6M+fS16BGZe5ZQbbagw+eGb5SvXTAQLXNTQmilYLYUi+qIjthP6hl2+KM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779135327; c=relaxed/simple; bh=ngdPnO1Cyjc/vJTeh8/x1Lz51F/x2nhH32sn1fzppwI=; h=Content-Type:Date:Message-Id:Cc:Subject:From:To:Mime-Version: References:In-Reply-To; b=NmxWacOziYsnL2yHIDaBUKLKn2vJJPsoWY9t+Vrf6BQJTHS6abQDY8u1pMo4ymbWai1BZ9mzaDdKsUoE6yAaKrXmmcMpb9XKnkBGpabH86/PMeVVkvInR0iyJXqW/dGVN5+1ba89OHQqgd0O83nREHT1Y0yjoF+ZOHVgflHpd80= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=LfzqjN5z; arc=none smtp.client-ip=74.125.82.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="LfzqjN5z" Received: by mail-dy1-f169.google.com with SMTP id 5a478bee46e88-303dbfbec77so1983006eec.0 for ; Mon, 18 May 2026 13:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1779135325; x=1779740125; darn=vger.kernel.org; h=in-reply-to:references:content-transfer-encoding:mime-version:to :from:subject:cc:message-id:date:from:to:cc:subject:date:message-id :reply-to; bh=xiFAZvz3hwO0i2u3Qu3Y6dXTODQg/m869IwtOfJVETM=; b=LfzqjN5zUD2TKK93TRSRnN8lEFPt4N3k3Ayz8o3KJkuU2hclLQ4/anChji4QBR7xlA JM/hv9pLsxvaKNKYMgA3LSfCKfEeiTGGYQDc+Va3uztBVirokdFRyMhVFybk88VQwwzD XSYKTia8VIJiO/mhxxeB01LqCypxkoDuVSRwnhWcFM5EIMElNefK7gb9oGN9ff/SdSnp P5T6sBWy9szsMN+PDM5rslFBw1pNR69mWZV1etQaBIC/0N2NVCo01xdUyFshXm29qw+z LfKbDMTBmTojzZlT1lzRpKzF5rK7+Y0xXAIw/a0FngcJNmSHwpkVTdOn/qrXOGjR0JIH y4cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779135325; x=1779740125; h=in-reply-to:references:content-transfer-encoding:mime-version:to :from:subject:cc:message-id:date:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=xiFAZvz3hwO0i2u3Qu3Y6dXTODQg/m869IwtOfJVETM=; b=RemTlwHiv6dP+zW1rlG3dOmc0KQKFBm25XhwoHA2UjHOSBEai2mze8Xxvq7LZRzuGW f0ddCof4ambSulh8TAvGhyfFOyfHn/62kgFjj7x6HeHsQ66+TQasxUR4je0bc543+6GU DDNipZhnk39K9GvtHN2oFom9m59CRgGQszncOpGiAF6K87MfhDv8DxYhbrFjCSUVuEYa ia4IAodT8z6b2a3++ln0T/grPHqsxv5d7oLALQ03QUk+npAgVhAbnJdeY1aRU+Mybmqf z5GZXhnU51OyNT94br9py940zPFOgytPncbsailqlMPINFZM6nhfUBDwSL5jXuacrm2+ jzDw== X-Forwarded-Encrypted: i=1; AFNElJ96gBEuTeQFjfy+e0KK4xgqgY+k0Ztbw2U5iskA+oEDTympJ4fDEqmee0aDvzcwrX9ANQcgIaQOMxNDskA=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1Wmw7fnReRoYlW/GDT2H44fWIqfZ5F3m2ZCGWsnZ3N2kUXgrF 3hOnkvD6y5RFUMO20q0Wi9RQK8gi12uO3L6fk0tOHvmaTlVIPJBwNxr6IL/QkdiTx8E= X-Gm-Gg: Acq92OEf5QirwinmMHn+yIvC3YcPS709AP+J9rZ5MzAtsIi18IhckgNzQJTFmVw01v0 nKBRFeObASU7ZJxoDhDTIGjxW3YMk5X2qPWLJ37AOUOqmzUJDDWP/NVH1yeJIinQ/mcceKky6EL sy5SUg/NCxg58f15frUdwv+++8CqcgiIcKaqcpCG2JYCwe0wow7yk9CRUY/CNwvLDHq/eIIVOUo K0pSVCt0yT4DpGdcwlwSUQx0nOVeYpcrwUDzWDJqo0fyQgMTfzKYkNa9k+WTlxvKmsvVecwTeuP 81HLh02gCbH9jrKvBzC8lhPPX06RZ9JmKCnwJMg93l/gRG89G4Oa1jfalnaZZu45l8N8TgnLN2U BRjFbEFMQqeXZ4AUqw7S9oSQ24uIM2Co3ablo040ahSVEVuYT8HWvurzUa6mH6ETCssacjw4k1Y EkOWTSLTkXo1HfvPXJ7GLlAyY= X-Received: by 2002:a05:7300:a146:b0:2e2:27bb:a48c with SMTP id 5a478bee46e88-3039816db2amr7491742eec.14.1779135324993; Mon, 18 May 2026 13:15:24 -0700 (PDT) Received: from localhost ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-302978ad18asm14388520eec.26.2026.05.18.13.15.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 13:15:24 -0700 (PDT) Content-Type: text/plain; charset=UTF-8 Date: Mon, 18 May 2026 13:15:23 -0700 Message-Id: Cc: , Subject: Re: [PATCH v3] i2c: mux: reg: use device property accessors From: "Abdurrahman Hussain" To: "Peter Rosin" , "Abdurrahman Hussain" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0 References: <20260513-i2c-mux-reg-v3-1-0fa7242605bc@nexthop.ai> In-Reply-To: On Mon May 18, 2026 at 6:59 AM PDT, Peter Rosin wrote: > > Hi! > > After reading v2/v3, I finally got why you removed if (!mux->data.reg). > I.e., since you removed the io-remapping from i2c_mux_reg_probe_fw() > that part can now be unconditional in i2c_mux_reg_probe(). But, > keeping the if just to accomodate potential out-of-tree code that uses > the platform data hooking is not needed so v1 feels better than v2/v3. > Sorry for being dense. However, see below. > Agreed -- v4 will drop the guard and make devm_platform_get_and_ioremap_resource() unconditional. Follow-up question while we're pruning the platdata path: with the guard gone, the .reg and .reg_size fields in struct i2c_mux_reg_platform_data are functionally dead (any value a platdata user supplied through them is overwritten by devm_platform_get_and_ioremap_resource()). Should I drop those two fields from the struct in the same patch, or leave them as silent no-ops in the public header? Happy either way. >> - adapter =3D of_find_i2c_adapter_by_node(adapter_np); >> - of_node_put(adapter_np); >> + >> + adapter =3D i2c_get_adapter_by_fwnode(fwnode); >> + fwnode_handle_put(fwnode); > > Why did you not change to i2c_find_adapter_by_fwnode()? It would be > closer to the original, but maybe that doesn't work for ACPI for some > reason? > It works for ACPI -- both _find and _get bottom out in i2c_find_adapter_by_fwnode(). My reason for picking the _get variant was simply that it does try_module_get(adapter->owner) on top. But i2c_get_adapter() further down in probe() already does the same try_module_get() and -EPROBE_DEFERs on failure, so the extra acquire-then-immediately-release in probe_fw() isn't earning us anything. v4 will switch to i2c_find_adapter_by_fwnode() + put_device(), matching the OF original more closely. >> - /* map address from "reg" if exists */ >> - if (of_address_to_resource(np, 0, &res) =3D=3D 0) { >> - mux->data.reg_size =3D resource_size(&res); >> - mux->data.reg =3D devm_ioremap_resource(&pdev->dev, &res); >> - if (IS_ERR(mux->data.reg)) >> - return PTR_ERR(mux->data.reg); >> - } >> - > > By not doing the io-remapping here, the ordering is now subtly altered. > Previously we had io-remapping before the call to i2c_get_adapter(). > With this change we instead have the call to i2c_get_adapter() before > the io-remapping. > > Since it is apparently difficult the get this patch tested for the > existing use cases, we should avoid as many of these innocent looking > but subtle changes as possible. > > Cheers, > Peter > Will fix that in v4 by reordering probe() so the devm_platform_get_and_ioremap_resource() call comes before i2c_get_adapter(), matching the master sequence. No need to push the ioremap back into probe_fw() -- the helper signature stays cleaner if probe() owns the call. Thanks for the careful re-read. Cheers, Abdurrahman