Re: [PATCH v4 1/3] power-domain: add power domain drivers for Rockchip platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




在 2014/10/21 5:31, Kevin Hilman 写道:
"jinkun.hong" <jinkun.hong@xxxxxxxxxxxxxx> writes:

From: "jinkun.hong" <jinkun.hong@xxxxxxxxxxxxxx>

Add power domain drivers based on generic power domain for Rockchip platform,
and support RK3288.

Signed-off-by: Jack Dai <jack.dai@xxxxxxxxxxxxxx>
Signed-off-by: jinkun.hong <jinkun.hong@xxxxxxxxxxxxxx>
[...]

+static int rockchip_pmu_set_idle_request(struct rockchip_domain *pd,
+					 bool idle)
+{
+	u32 idle_mask = BIT(pd->idle_shift);
+	u32 idle_target = idle << (pd->idle_shift);
+	u32 ack_mask = BIT(pd->ack_shift);
+	u32 ack_target = idle << (pd->ack_shift);
+	unsigned int mask = BIT(pd->req_shift);
+	unsigned int val;
+	unsigned long flags;
+
+	spin_lock_irqsave(&pd->idle_lock, flags);
+	val = (idle) ? mask : 0;
+	regmap_update_bits(pd->regmap_pmu, REQ_OFFSET, mask, val);
+	dsb();
A summary of the locking and barriers here (or in changelog) would be
helpful for reviewers to verify you're protecting what you need to
protect.

+	do {
+		regmap_read(pd->regmap_pmu, ACK_OFFSET, &val);
+	} while ((val & ack_mask) != ack_target);
+
+	do {
+		regmap_read(pd->regmap_pmu, IDLE_OFFSET, &val);
+	} while ((val & idle_mask) != idle_target);
+
+	spin_unlock_irqrestore(&pd->idle_lock, flags);
These IRQ-disabled while loops look like opportunities to lockup the
system.  Maybe add a timeout or a maximum number of tries?
Ok,I will add a timeout in new version.
+	return 0;
+}
Kevin



Thank you for your review.

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




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux