linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Menon, Nishanth" <nm@ti.com>
To: Sanjeev Premi <premi@ti.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled
Date: Thu, 12 May 2011 13:02:18 -0500	[thread overview]
Message-ID: <BANLkTim+3M3Z0C3GTtTQrb2cqk5eSAsR+w@mail.gmail.com> (raw)
In-Reply-To: <1305221790-4944-1-git-send-email-premi@ti.com>

On Thu, May 12, 2011 at 12:36, Sanjeev Premi <premi@ti.com> wrote:
> There is an implicit assumption in current implementation that
> debugfs is always enabled.
thanks for doing this.
>
> When debugfs is disabled, these errors are noticed during boot:
>  omap_voltage_late_init: Unable to create voltage debugfs main dir
>  vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
>  vdd_debugfs_init: Unable to create debugfs directory for vdd_core
>
> This patch fixes these errors by enclosing code related to debugfs
> in #ifdef CONFIG_DEBUG_FS..#endif.

generic - couple of comments - I think the #defs should be isolated
off to headers - maybe the right approach may be to move the debugfs
entries off to a separate file? or pm-debug.c??

>
> Boot tested on OMAP3EVM.
>
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  Patch was created and tested on the pm branch at commit:
>   d695569 : rebuild PM from branches

Could I suggest Kevin's volt cleanup series - based off _c branch if
there are cleanups to be done?

>
>  I am still finding my way around new code sructure. Haven't
>  been able to verify if smartreflex and voltage layer are
>  properly initialized. Though I do understand that smartreflex
>  won't work without debugfs.
>

Last I tried, with Vishwa's dvfs branch on panda without voltage
registrations, things could crash :( if I get some time I will try to
port Vishwa's series onto kevin's branch as well and test and provide
any patches necessary.


>  arch/arm/mach-omap2/smartreflex.c |   15 +++++++++++++++
>  arch/arm/mach-omap2/voltage.c     |    8 ++++++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 2ce2fb7..b757632 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -54,7 +54,9 @@ struct omap_sr {
>        struct list_head                node;
>        struct omap_sr_nvalue_table     *nvalue_table;
>        struct voltagedomain            *voltdm;
> +#ifdef CONFIG_DEBUG_FS
>        struct dentry                   *dbg_dir;
> +#endif
>  };
>
>  /* sr_list contains all the instances of smartreflex module */
> @@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>        struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
>        struct omap_sr_data *pdata = pdev->dev.platform_data;
>        struct resource *mem, *irq;
> +#ifdef CONFIG_DEBUG_FS
>        struct dentry *vdd_dbg_dir, *nvalue_dir;
> +#endif
>        struct omap_volt_data *volt_data;
>        int i, ret = 0;
>
> @@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>         * If the voltage domain debugfs directory is not created, do
>         * not try to create rest of the debugfs entries.
>         */
> +#ifdef CONFIG_DEBUG_FS
>        vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
>        if (!vdd_dbg_dir) {
>                ret = -EINVAL;
> @@ -952,14 +957,22 @@ static int __init omap_sr_probe(struct platform_device *pdev)
>                (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
>                                &(sr_info->nvalue_table[i].nvalue));
>        }
> +#else
> +       omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
> +       if (!volt_data) {
> +               ret = -ENODATA;
> +       }
> +#endif /* CONFIG_DEBUG_FS */
>
>        return ret;
>
> +#ifdef CONFIG_DEBUG_FS
>  err_debugfs:
>        debugfs_remove_recursive(sr_info->dbg_dir);
>  err_iounmap:
>        list_del(&sr_info->node);
>        iounmap(sr_info->base);
> +#endif
>  err_release_region:
>        release_mem_region(mem->start, resource_size(mem));
>  err_free_devinfo:
> @@ -988,8 +1001,10 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
>
>        if (sr_info->autocomp_active)
>                sr_stop_vddautocomp(sr_info);
> +#ifdef CONFIG_DEBUG_FS
>        if (sr_info->dbg_dir)
>                debugfs_remove_recursive(sr_info->dbg_dir);
> +#endif
>
>        list_del(&sr_info->node);
>        iounmap(sr_info->base);
> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
> index 9ef3789..6153211 100644
> --- a/arch/arm/mach-omap2/voltage.c
> +++ b/arch/arm/mach-omap2/voltage.c
> @@ -250,6 +250,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
>        vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
>  }
>
> +#ifdef CONFIG_DEBUG_FS
>  static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
>  {
>        char *name;
> @@ -297,6 +298,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
>                                vdd->debug_dir, (void *) vdd,
>                                &nom_volt_debug_fops);
>  }
> +#endif
>
>  /* Voltage scale and accessory APIs */
>  static int _pre_volt_scale(struct omap_vdd_info *vdd,
> @@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
>  * add any debug entry for a particular voltage domain. Returns NULL
>  * in case of error.
>  */
> +#ifdef CONFIG_DEBUG_FS
>  struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
>  {
>        struct omap_vdd_info *vdd;
> @@ -993,6 +996,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
>
>        return vdd->debug_dir;
>  }
> +#endif
>
>  /**
>  * omap_change_voltscale_method() - API to change the voltage scaling method.
> @@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
>                return -EINVAL;
>        }
>
> +#ifdef CONFIG_DEBUG_FS
>        voltage_dir = debugfs_create_dir("voltage", NULL);
>        if (IS_ERR(voltage_dir))
>                pr_err("%s: Unable to create voltage debugfs main dir\n",
>                        __func__);
> +#endif
>        for (i = 0; i < nr_scalable_vdd; i++) {
>                if (omap_vdd_data_configure(vdd_info[i]))
>                        continue;
>                omap_vc_init(vdd_info[i]);
>                vp_init(vdd_info[i]);
> +#ifdef CONFIG_DEBUG_FS
>                vdd_debugfs_init(vdd_info[i]);
> +#endif
>        }
>
>        return 0;
> --
> 1.7.2.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-05-12 18:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 17:36 [PATCH] omap:pm: Fix boot-time errors with debugfs disabled Sanjeev Premi
2011-05-12 18:02 ` Menon, Nishanth [this message]
2011-05-12 19:16   ` Premi, Sanjeev
2011-05-12 19:58     ` Todd Poynor
2011-05-12 21:03       ` Nishanth Menon
2011-05-13 12:48     ` Premi, Sanjeev
2011-05-17 14:40       ` Premi, Sanjeev
2011-05-18  8:25     ` Menon, Nishanth
2011-05-18  9:00       ` Premi, Sanjeev
2011-05-18  9:06         ` Menon, Nishanth
2011-05-18  9:16           ` Premi, Sanjeev
2011-05-18 16:34 ` Kevin Hilman
2011-05-18 18:48   ` Menon, Nishanth
2011-05-19 10:30   ` Premi, Sanjeev
2011-05-19 13:58     ` Menon, Nishanth
2011-05-20 15:21       ` Premi, Sanjeev
2011-05-24 23:57         ` Kevin Hilman

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=BANLkTim+3M3Z0C3GTtTQrb2cqk5eSAsR+w@mail.gmail.com \
    --to=nm@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=premi@ti.com \
    /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;
as well as URLs for NNTP newsgroup(s).