static inline u8 get_vbus_power(struct device *dev) { struct regulator *vbus_supply; int current_uA; vbus_supply = regulator_get_optional(dev, "vbus"); if (IS_ERR(vbus_supply)) return 255; current_uA = regulator_get_current_limit(vbus_supply); regulator_put(vbus_supply); if (current_uA <= 0 || current_uA > 510000) return 255; return current_uA / 1000 / 2; }
static ssize_t pt_val_show(struct device *d, struct device_attribute *attr, char *buf) { REG_GET(); return sprintf(buf, "%d\n", regulator_get_current_limit(reg)); }