From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarkko Sakkinen Subject: Re: [PATCH v4 5/8] tpm: replace of_find_node_by_name() with dev of_node property Date: Fri, 30 Sep 2016 22:12:44 +0300 Message-ID: <20160930191244.GD9595@intel.com> References: <1475051682-23060-1-git-send-email-nayna@linux.vnet.ibm.com> <1475051682-23060-6-git-send-email-nayna@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1475051682-23060-6-git-send-email-nayna-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Nayna Jain Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: tpmdd-devel@lists.sourceforge.net On Wed, Sep 28, 2016 at 04:34:39AM -0400, Nayna Jain wrote: > Using the device of_node property is a better way to refer to the > device tree node rather than of_find_node_by_name(). > > Suggested-by: Jason Gunthorpe > Signed-off-by: Nayna Jain Reviewed-by: Jarkko Sakkinen /Jarkko > --- > drivers/char/tpm/tpm_of.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c > index 7c30752..22b8f81 100644 > --- a/drivers/char/tpm/tpm_of.c > +++ b/drivers/char/tpm/tpm_of.c > @@ -29,7 +29,8 @@ int read_log_of(struct tpm_chip *chip) > struct tpm_bios_log *log; > > log = &chip->log; > - np = of_find_node_by_name(NULL, "vtpm"); > + if (chip->dev.parent->of_node) > + np = chip->dev.parent->of_node; > if (!np) { > pr_err("%s: ERROR - IBMVTPM not supported\n", __func__); > return -ENODEV; > @@ -55,18 +56,15 @@ int read_log_of(struct tpm_chip *chip) > if (!log->bios_event_log) { > pr_err("%s: ERROR - Not enough memory for BIOS measurements\n", > __func__); > - of_node_put(np); > return -ENOMEM; > } > > log->bios_event_log_end = log->bios_event_log + *sizep; > > memcpy(log->bios_event_log, __va(*basep), *sizep); > - of_node_put(np); > > return 0; > > cleanup_eio: > - of_node_put(np); > return -EIO; > } > -- > 2.5.0 > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot