phys_addr_t reg;
u32 offset, val, mask, bit_pos, val_pos, mask_pos, submask;
+ /* If function mask is null, needn't enable it. */
+ if (!pdata->mask)
+ return 0;
+
npins_in_reg = pdata->width / priv->bits_per_pin;
func = single_allocate_function(dev, count * npins_in_reg);
if (IS_ERR(func))
priv->npins = size / (pdata->width / BITS_PER_BYTE);
if (pdata->bits_per_mux) {
+ if (!pdata->mask) {
+ dev_err(dev, "function mask needs to be non-zero\n");
+ return -EINVAL;
+ }
+
priv->bits_per_pin = fls(pdata->mask);
priv->npins *= (pdata->width / priv->bits_per_pin);
}