Lines Matching defs:unit
315 int sm501_unit_power(struct device *dev, unsigned int unit, unsigned int to)
330 if (unit >= ARRAY_SIZE(sm->unit_power)) {
331 dev_err(dev, "%s: bad unit %d\n", __func__, unit);
335 dev_dbg(sm->dev, "%s: unit %d, cur %d, to %d\n", __func__, unit,
336 sm->unit_power[unit], to);
338 if (to == 0 && sm->unit_power[unit] == 0) {
339 dev_err(sm->dev, "unit %d is already shutdown\n", unit);
343 sm->unit_power[unit] += to ? 1 : -1;
344 to = sm->unit_power[unit] ? 1 : 0;
347 if (gate & (1 << unit))
349 gate |= (1 << unit);
351 if (!(gate & (1 << unit)))
353 gate &= ~(1 << unit);