From: Patrick Havelange <patrick.havelange@essensium.com>
To: Madalin Bucur <madalin.bucur@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Subject: [PATCH net 0/4] freescale/fman: remove usage of __devm_request_region
Date: Thu, 3 Dec 2020 14:50:35 +0100 [thread overview]
Message-ID: <20201203135039.31474-1-patrick.havelange@essensium.com> (raw)
Hello,
This patch series is solving a bug inside
ethernet/freescale/fman/fman_port.c caused by an incorrect usage of
__devm_request_region.
The bug came from the fact that the resource given as parameter to the
function __devm_request_region is on the stack, leading to an invalid
pointer being stored inside the devres structure, and the new resource
pointer being lost.
In order to solve this, it is first necessary to make the regular call
devm_request_mem_region work.
This call cannot work as is, because the main fman driver has already
reserved the memory region used by the fman_port driver.
Thus the first action is to split the memory region reservation done in
the main fman driver in two, so that the regions used by fman_port will
not be reserved. The main memory regions have also been reduced to not
request the memory regions used by fman_mac.
Once this first step is done, regular usage of devm_request_mem_region
can be done.
This also leads to a bit of code removal done in the last patch.
1. fman: split the memory region of the main fman driver, so the memory that
will be used by fman_port & fman_mac will not be already reserved.
2. fman_port: replace call of __devm_request_region to devm_request_mem_region
3. fman_mac: replace call of __devm_request_region to devm_request_mem_region
4. the code is now simplified a bit, there is no need to store the main region
anymore
The whole point of this series is to be able to apply the patch N°2.
Since N°3 is a similar change, let's do it at the same time.
I think they all should be part of the same series.
Patrick Havelange (4):
net: freescale/fman: Split the main resource region reservation
net: freescale/fman-port: remove direct use of __devm_request_region
net: freescale/fman-mac: remove direct use of __devm_request_region
net: freescale/fman: remove fman_get_mem_region
drivers/net/ethernet/freescale/fman/fman.c | 120 +++++++++---------
drivers/net/ethernet/freescale/fman/fman.h | 11 +-
.../net/ethernet/freescale/fman/fman_port.c | 6 +-
drivers/net/ethernet/freescale/fman/mac.c | 8 +-
4 files changed, 75 insertions(+), 70 deletions(-)
base-commit: 832e09798c261cf58de3a68cfcc6556408c16a5a
--
2.17.1
next reply other threads:[~2020-12-03 13:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-03 13:50 Patrick Havelange [this message]
2020-12-03 13:50 ` [PATCH net 1/4] net: freescale/fman: Split the main resource region reservation Patrick Havelange
2020-12-03 15:47 ` Madalin Bucur
2020-12-08 14:55 ` Patrick Havelange
2020-12-09 9:10 ` Madalin Bucur
2020-12-09 14:16 ` Patrick Havelange
2020-12-09 18:55 ` Madalin Bucur
2020-12-10 8:49 ` Patrick Havelange
2020-12-10 9:05 ` Madalin Bucur
2020-12-10 10:05 ` Patrick Havelange
2020-12-10 10:46 ` Madalin Bucur
2020-12-03 13:50 ` [PATCH net 2/4] net: freescale/fman-port: remove direct use of __devm_request_region Patrick Havelange
2020-12-03 13:50 ` [PATCH net 3/4] net: freescale/fman-mac: " Patrick Havelange
2020-12-03 13:50 ` [PATCH net 4/4] net: freescale/fman: remove fman_get_mem_region Patrick Havelange
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=20201203135039.31474-1-patrick.havelange@essensium.com \
--to=patrick.havelange@essensium.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
/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
all inboxes | Powered by JetHome®