Ver Fonte

waterDataStatisticsCrossAssociation rtuDataOperation.c 李欣儒 commit at 2021-03-26

李欣儒 há 4 anos atrás
pai
commit
d14a52e7a9

+ 25 - 0
waterDataStatisticsCrossAssociation/databaseOperation/rtuDataOperation.c

@@ -691,3 +691,28 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused)
 	/*
 	 * Extract the IDs from name field in hwmod database
 	 * and use the same for constructing ids' for the
+	 * timer devices. In a way, we are avoiding usage of
+	 * static variable witin the function to do the same.
+	 * CAUTION: We have to be careful and make sure the
+	 * name in hwmod database does not change in which case
+	 * we might either make corresponding change here or
+	 * switch back static variable mechanism.
+	 */
+	sscanf(oh->name, "timer%2d", &id);
+
+	if (timer_dev_attr)
+		pdata->timer_capability = timer_dev_attr->timer_capability;
+
+	pdata->timer_errata = omap_dm_timer_get_errata();
+	pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count;
+
+	pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata),
+				 NULL, 0, 0);
+
+	if (IS_ERR(pdev)) {
+		pr_err("%s: Can't build omap_device for %s: %s.\n",
+			__func__, name, oh->name);
+		ret = -EINVAL;
+	}
+
+	kfree(pdata);