linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] freescale/fman: remove usage of __devm_request_region
@ 2020-12-03 13:50 Patrick Havelange
  2020-12-03 13:50 ` [PATCH net 1/4] net: freescale/fman: Split the main resource region reservation Patrick Havelange
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Patrick Havelange @ 2020-12-03 13:50 UTC (permalink / raw)
  To: Madalin Bucur, David S. Miller, Jakub Kicinski, netdev, linux-kernel
  Cc: Patrick Havelange

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-12-10 10:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 13:50 [PATCH net 0/4] freescale/fman: remove usage of __devm_request_region Patrick Havelange
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

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).