Commit f92e7d1144a872b6f2d4ad1bc7d778ee1a6dde61

Authored by Rajendra Nayak
Committed by Afzal Mohammed
1 parent 536a4c8bb7
Exists in master

OMAP: dvfs: Create a dvfs_info per voltdm and not per device

Allocating dvfs_info for every device instead of doing it
for every voltage domain causes devices registered using
omap_dvfs_register_device() to disappear.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
[vaibhav.bedia@ti.com: Pull in for AM33xx]
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>

Showing 1 changed file with 10 additions and 9 deletions Side-by-side Diff

arch/arm/mach-omap2/dvfs.c
... ... @@ -898,6 +898,7 @@
898 898 struct omap_vdd_dev_list *temp_dev;
899 899 struct omap_vdd_dvfs_info *dvfs_info;
900 900 struct clk *clk = NULL;
  901 + struct voltagedomain *voltdm;
901 902 int ret = 0;
902 903  
903 904 if (!voltdm_name) {
... ... @@ -912,7 +913,14 @@
912 913 /* Lock me to secure structure changes */
913 914 mutex_lock(&omap_dvfs_lock);
914 915  
915   - dvfs_info = _dev_to_dvfs_info(dev);
  916 + voltdm = voltdm_lookup(voltdm_name);
  917 + if (!voltdm) {
  918 + dev_warn(dev, "%s: unable to find voltdm %s!\n",
  919 + __func__, voltdm_name);
  920 + ret = -EINVAL;
  921 + goto out;
  922 + }
  923 + dvfs_info = _voltdm_to_dvfs_info(voltdm);
916 924 if (!dvfs_info) {
917 925 dvfs_info = kzalloc(sizeof(struct omap_vdd_dvfs_info),
918 926 GFP_KERNEL);
... ... @@ -922,14 +930,7 @@
922 930 ret = -ENOMEM;
923 931 goto out;
924 932 }
925   - dvfs_info->voltdm = voltdm_lookup(voltdm_name);
926   - if (!dvfs_info->voltdm) {
927   - dev_warn(dev, "%s: unable to find voltdm %s!\n",
928   - __func__, voltdm_name);
929   - kfree(dvfs_info);
930   - ret = -EINVAL;
931   - goto out;
932   - }
  933 + dvfs_info->voltdm = voltdm;
933 934  
934 935 /* Init the plist */
935 936 spin_lock_init(&dvfs_info->user_lock);