Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1650499 > unrolled thread

Re: [PATCH 06/24] thunderbolt: Introduce thunderbolt bus and connection manager

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-05-25 15:30 +0200
Last post2017-05-25 16:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 06/24] thunderbolt: Introduce thunderbolt bus and  connection manager Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-25 15:30 +0200
    Re: [PATCH 06/24] thunderbolt: Introduce thunderbolt bus and  connection manager Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-05-25 16:50 +0200

#1650499 — Re: [PATCH 06/24] thunderbolt: Introduce thunderbolt bus and connection manager

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-05-25 15:30 +0200
SubjectRe: [PATCH 06/24] thunderbolt: Introduce thunderbolt bus and connection manager
Message-ID<tL0ZY-iP-1@gated-at.bofh.it>
On Thu, May 18, 2017 at 05:38:56PM +0300, Mika Westerberg wrote:
> Thunderbolt fabric consists of one or more switches. This fabric is
> called domain and it is controlled by an entity called connection
> manager. The connection manager can be either internal (driven by a
> firmware running on the host controller) or external (software driver).
> This driver currently implements support for the latter.
> 
> In order to manage switches and their properties more easily we model
> this domain structure as a Linux bus. Each host controller adds a domain
> device to this bus, and these devices are named as domainN where N
> stands for index or id of the current domain.
> 
> We then abstract connection manager specific operations into a new
> structure tb_cm_ops and convert the existing tb.c to fill those
> accordingly. This makes it easier to add support for the internal
> connection manager in subsequent patches.
> 
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
> Reviewed-by: Michael Jamet <michael.jamet@intel.com>
> ---
>  drivers/thunderbolt/Makefile     |   2 +-
>  drivers/thunderbolt/domain.c     | 230 +++++++++++++++++++++++++++++++++++++++
>  drivers/thunderbolt/nhi.c        |  31 ++++--
>  drivers/thunderbolt/tb.c         | 156 ++++++++++++--------------
>  drivers/thunderbolt/tb.h         |  70 +++++++++---
>  drivers/thunderbolt/tunnel_pci.c |   9 +-
>  6 files changed, 377 insertions(+), 121 deletions(-)
>  create mode 100644 drivers/thunderbolt/domain.c
> 
> diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile
> index 5d1053cdfa54..e276a9a62261 100644
> --- a/drivers/thunderbolt/Makefile
> +++ b/drivers/thunderbolt/Makefile
> @@ -1,3 +1,3 @@
>  obj-${CONFIG_THUNDERBOLT} := thunderbolt.o
>  thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
> -
> +thunderbolt-objs += domain.o
> diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
> new file mode 100644
> index 000000000000..b5bfca95415d
> --- /dev/null
> +++ b/drivers/thunderbolt/domain.c
> @@ -0,0 +1,230 @@
> +/*
> + * Thunderbolt bus support
> + *
> + * Copyright (C) 2017, Intel Corporation
> + * Author:  Mika Westerberg <mika.westerberg@linux.intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/device.h>
> +#include <linux/idr.h>
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +
> +#include "tb.h"
> +
> +static DEFINE_IDA(tb_domain_ida);

You forgot to clean this up in your module exit code with a call to
ida_destroy(&tb_domain_ida);

Yeah, it's not obvious, I've made the same mistake before :)

Other than that minor thing, the bus logic looks good, nice job.

thanks,

greg k-h

[toc] | [next] | [standalone]


#1650567

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2017-05-25 16:50 +0200
Message-ID<tL2fo-ZP-5@gated-at.bofh.it>
In reply to#1650499
On Thu, May 25, 2017 at 03:23:39PM +0200, Greg Kroah-Hartman wrote:
> On Thu, May 18, 2017 at 05:38:56PM +0300, Mika Westerberg wrote:
> > Thunderbolt fabric consists of one or more switches. This fabric is
> > called domain and it is controlled by an entity called connection
> > manager. The connection manager can be either internal (driven by a
> > firmware running on the host controller) or external (software driver).
> > This driver currently implements support for the latter.
> > 
> > In order to manage switches and their properties more easily we model
> > this domain structure as a Linux bus. Each host controller adds a domain
> > device to this bus, and these devices are named as domainN where N
> > stands for index or id of the current domain.
> > 
> > We then abstract connection manager specific operations into a new
> > structure tb_cm_ops and convert the existing tb.c to fill those
> > accordingly. This makes it easier to add support for the internal
> > connection manager in subsequent patches.
> > 
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
> > Reviewed-by: Michael Jamet <michael.jamet@intel.com>
> > ---
> >  drivers/thunderbolt/Makefile     |   2 +-
> >  drivers/thunderbolt/domain.c     | 230 +++++++++++++++++++++++++++++++++++++++
> >  drivers/thunderbolt/nhi.c        |  31 ++++--
> >  drivers/thunderbolt/tb.c         | 156 ++++++++++++--------------
> >  drivers/thunderbolt/tb.h         |  70 +++++++++---
> >  drivers/thunderbolt/tunnel_pci.c |   9 +-
> >  6 files changed, 377 insertions(+), 121 deletions(-)
> >  create mode 100644 drivers/thunderbolt/domain.c
> > 
> > diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile
> > index 5d1053cdfa54..e276a9a62261 100644
> > --- a/drivers/thunderbolt/Makefile
> > +++ b/drivers/thunderbolt/Makefile
> > @@ -1,3 +1,3 @@
> >  obj-${CONFIG_THUNDERBOLT} := thunderbolt.o
> >  thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
> > -
> > +thunderbolt-objs += domain.o
> > diff --git a/drivers/thunderbolt/domain.c b/drivers/thunderbolt/domain.c
> > new file mode 100644
> > index 000000000000..b5bfca95415d
> > --- /dev/null
> > +++ b/drivers/thunderbolt/domain.c
> > @@ -0,0 +1,230 @@
> > +/*
> > + * Thunderbolt bus support
> > + *
> > + * Copyright (C) 2017, Intel Corporation
> > + * Author:  Mika Westerberg <mika.westerberg@linux.intel.com>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/device.h>
> > +#include <linux/idr.h>
> > +#include <linux/module.h>
> > +#include <linux/slab.h>
> > +
> > +#include "tb.h"
> > +
> > +static DEFINE_IDA(tb_domain_ida);
> 
> You forgot to clean this up in your module exit code with a call to
> ida_destroy(&tb_domain_ida);

Ah, I see. OK, I'll add that missing call to tb_domain_exit().

> Yeah, it's not obvious, I've made the same mistake before :)
> 
> Other than that minor thing, the bus logic looks good, nice job.

Thanks :-)

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web