diff mbox series

[v1,16/18] efi: Update implementation of add_links() to create fwnode links

Message ID 20201104232356.4038506-17-saravanak@google.com
State New
Headers show
Series Refactor fw_devlink to significantly improve boot time | expand

Commit Message

Saravana Kannan Nov. 4, 2020, 11:23 p.m. UTC
The semantics of add_links() has changed from creating device link
between devices to creating fwnode links between fwnodes. So, update the
implementation of add_links() to match the new semantics.

Signed-off-by: Saravana Kannan <saravanak@google.com>
---
 drivers/firmware/efi/efi-init.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

Comments

Greg Kroah-Hartman Nov. 5, 2020, 9:43 a.m. UTC | #1
On Wed, Nov 04, 2020 at 03:23:53PM -0800, Saravana Kannan wrote:
> The semantics of add_links() has changed from creating device link

> between devices to creating fwnode links between fwnodes. So, update the

> implementation of add_links() to match the new semantics.

> 

> Signed-off-by: Saravana Kannan <saravanak@google.com>

> ---

>  drivers/firmware/efi/efi-init.c | 23 ++---------------------

>  1 file changed, 2 insertions(+), 21 deletions(-)

> 

> diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c

> index b148f1459fb3..c0c3d4c3837a 100644

> --- a/drivers/firmware/efi/efi-init.c

> +++ b/drivers/firmware/efi/efi-init.c

> @@ -316,11 +316,10 @@ static struct device_node *find_pci_overlap_node(void)

>   * resource reservation conflict on the memory window that the efifb

>   * framebuffer steals from the PCIe host bridge.

>   */

> -static int efifb_add_links(const struct fwnode_handle *fwnode,

> +static int efifb_add_links(struct fwnode_handle *fwnode,

>  			   struct device *dev)


So you are fixing the build warning you added a few patches ago here?
Please fix up the function signatures when you made that change, not
here later on.

thanks,

greg k-h
Saravana Kannan Nov. 5, 2020, 11:27 p.m. UTC | #2
On Thu, Nov 5, 2020 at 1:42 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Wed, Nov 04, 2020 at 03:23:53PM -0800, Saravana Kannan wrote:
> > The semantics of add_links() has changed from creating device link
> > between devices to creating fwnode links between fwnodes. So, update the
> > implementation of add_links() to match the new semantics.
> >
> > Signed-off-by: Saravana Kannan <saravanak@google.com>
> > ---
> >  drivers/firmware/efi/efi-init.c | 23 ++---------------------
> >  1 file changed, 2 insertions(+), 21 deletions(-)
> >
> > diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
> > index b148f1459fb3..c0c3d4c3837a 100644
> > --- a/drivers/firmware/efi/efi-init.c
> > +++ b/drivers/firmware/efi/efi-init.c
> > @@ -316,11 +316,10 @@ static struct device_node *find_pci_overlap_node(void)
> >   * resource reservation conflict on the memory window that the efifb
> >   * framebuffer steals from the PCIe host bridge.
> >   */
> > -static int efifb_add_links(const struct fwnode_handle *fwnode,
> > +static int efifb_add_links(struct fwnode_handle *fwnode,
> >                          struct device *dev)
>
> So you are fixing the build warning you added a few patches ago here?
> Please fix up the function signatures when you made that change, not
> here later on.

I'm trying not to have a mega patcht that changes a lot of code.

I guess I can drop this "const" diff from this patch and then merge it
with the earlier patch that removes the const. But still leave the
rest of the changes in this patch as is. Does that work for you?

-Saravana
Greg Kroah-Hartman Nov. 6, 2020, 6:45 a.m. UTC | #3
On Thu, Nov 05, 2020 at 03:27:52PM -0800, Saravana Kannan wrote:
> On Thu, Nov 5, 2020 at 1:42 AM Greg Kroah-Hartman

> <gregkh@linuxfoundation.org> wrote:

> >

> > On Wed, Nov 04, 2020 at 03:23:53PM -0800, Saravana Kannan wrote:

> > > The semantics of add_links() has changed from creating device link

> > > between devices to creating fwnode links between fwnodes. So, update the

> > > implementation of add_links() to match the new semantics.

> > >

> > > Signed-off-by: Saravana Kannan <saravanak@google.com>

> > > ---

> > >  drivers/firmware/efi/efi-init.c | 23 ++---------------------

> > >  1 file changed, 2 insertions(+), 21 deletions(-)

> > >

> > > diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c

> > > index b148f1459fb3..c0c3d4c3837a 100644

> > > --- a/drivers/firmware/efi/efi-init.c

> > > +++ b/drivers/firmware/efi/efi-init.c

> > > @@ -316,11 +316,10 @@ static struct device_node *find_pci_overlap_node(void)

> > >   * resource reservation conflict on the memory window that the efifb

> > >   * framebuffer steals from the PCIe host bridge.

> > >   */

> > > -static int efifb_add_links(const struct fwnode_handle *fwnode,

> > > +static int efifb_add_links(struct fwnode_handle *fwnode,

> > >                          struct device *dev)

> >

> > So you are fixing the build warning you added a few patches ago here?

> > Please fix up the function signatures when you made that change, not

> > here later on.

> 

> I'm trying not to have a mega patcht that changes a lot of code.

> 

> I guess I can drop this "const" diff from this patch and then merge it

> with the earlier patch that removes the const. But still leave the

> rest of the changes in this patch as is. Does that work for you?


Yes, that's fine, you just can't add build warnings along the way.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index b148f1459fb3..c0c3d4c3837a 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -316,11 +316,10 @@  static struct device_node *find_pci_overlap_node(void)
  * resource reservation conflict on the memory window that the efifb
  * framebuffer steals from the PCIe host bridge.
  */
-static int efifb_add_links(const struct fwnode_handle *fwnode,
+static int efifb_add_links(struct fwnode_handle *fwnode,
 			   struct device *dev)
 {
 	struct device_node *sup_np;
-	struct device *sup_dev;
 
 	sup_np = find_pci_overlap_node();
 
@@ -331,27 +330,9 @@  static int efifb_add_links(const struct fwnode_handle *fwnode,
 	if (!sup_np)
 		return 0;
 
-	sup_dev = get_dev_from_fwnode(&sup_np->fwnode);
+	fwnode_link_add(fwnode, of_fwnode_handle(sup_np));
 	of_node_put(sup_np);
 
-	/*
-	 * Return -ENODEV if the PCI graphics controller device hasn't been
-	 * registered yet.  This ensures that efifb isn't allowed to probe
-	 * and this function is retried again when new devices are
-	 * registered.
-	 */
-	if (!sup_dev)
-		return -ENODEV;
-
-	/*
-	 * If this fails, retrying this function at a later point won't
-	 * change anything. So, don't return an error after this.
-	 */
-	if (!device_link_add(dev, sup_dev, fw_devlink_get_flags()))
-		dev_warn(dev, "device_link_add() failed\n");
-
-	put_device(sup_dev);
-
 	return 0;
 }