diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-05 11:31:35 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-05-05 11:31:35 +0200 |
commit | 8e91536a000c1738e354827d6f72965fa1444985 (patch) | |
tree | cb48104fa7a635e82d2b8b8eed6af6fe671756f2 /drivers | |
parent | 30cce0c7414498317a43b2020dc1737b007acf98 (diff) | |
parent | 0071bacb4c7cab21c9fab8540f5aa9922a270a85 (diff) | |
download | barebox-8e91536a000c1738e354827d6f72965fa1444985.tar.gz barebox-8e91536a000c1738e354827d6f72965fa1444985.tar.xz |
Merge branch 'for-next/parameter-types'
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/amba/bus.c | 2 | ||||
-rw-r--r-- | drivers/efi/efi-device.c | 12 | ||||
-rw-r--r-- | drivers/input/qt1070.c | 4 | ||||
-rw-r--r-- | drivers/mtd/core.c | 30 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 34 | ||||
-rw-r--r-- | drivers/mtd/peb.c | 6 | ||||
-rw-r--r-- | drivers/mtd/ubi/build.c | 22 | ||||
-rw-r--r-- | drivers/net/phy/mdio_bus.c | 4 | ||||
-rw-r--r-- | drivers/pwm/core.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/udc-core.c | 4 | ||||
-rw-r--r-- | drivers/video/backlight.c | 2 | ||||
-rw-r--r-- | drivers/video/imx-ipu-fb.c | 2 | ||||
-rw-r--r-- | drivers/video/imx.c | 2 |
14 files changed, 81 insertions, 63 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index ddd9661806..ae5df13c96 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -155,7 +155,7 @@ int amba_device_add(struct amba_device *dev) if (ret) goto err_release; - dev_add_param_int_ro(&dev->dev, "periphid", dev->periphid, "0x%08x"); + dev_add_param_uint32_fixed(&dev->dev, "periphid", dev->periphid, "0x%08x"); return ret; err_release: diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c index e9b03cb02a..9975aea6f7 100644 --- a/drivers/efi/efi-device.c +++ b/drivers/efi/efi-device.c @@ -404,12 +404,12 @@ static int efi_init_devices(void) dev_add_param_fixed(efi_bus.dev, "fw_vendor", fw_vendor); free(fw_vendor); - dev_add_param_int_ro(efi_bus.dev, "major", sys_major, "%u"); - dev_add_param_int_ro(efi_bus.dev, "minor", sys_minor, "%u"); - dev_add_param_int_ro(efi_bus.dev, "fw_revision", efi_sys_table->fw_revision, "%u"); - dev_add_param_int_ro(efi_bus.dev, "secure_boot", secure_boot, "%d"); - dev_add_param_int_ro(efi_bus.dev, "secure_mode", - secure_boot & setup_mode, "%u"); + dev_add_param_uint32_fixed(efi_bus.dev, "major", sys_major, "%u"); + dev_add_param_uint32_fixed(efi_bus.dev, "minor", sys_minor, "%u"); + dev_add_param_uint32_fixed(efi_bus.dev, "fw_revision", efi_sys_table->fw_revision, "%u"); + dev_add_param_bool_fixed(efi_bus.dev, "secure_boot", secure_boot); + dev_add_param_bool_fixed(efi_bus.dev, "secure_mode", + secure_boot & setup_mode); efi_bus.dev->info = efi_businfo; diff --git a/drivers/input/qt1070.c b/drivers/input/qt1070.c index 1ee868dfdd..d81a8fa401 100644 --- a/drivers/input/qt1070.c +++ b/drivers/input/qt1070.c @@ -238,8 +238,8 @@ static int qt1070_probe(struct device_d *dev) goto err; } - dev_add_param_int_ro(dev, "fw_version", fw_version, "0x%x"); - dev_add_param_int_ro(dev, "chip_ip", chip_id, "0x%x"); + dev_add_param_uint32_fixed(dev, "fw_version", fw_version, "0x%x"); + dev_add_param_uint32_fixed(dev, "chip_ip", chip_id, "0x%x"); memcpy(data->code, default_code, sizeof(int) * ARRAY_SIZE(default_code)); diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 1eb8dd36d8..1950ee87ee 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -449,13 +449,13 @@ static struct file_operations mtd_ops = { .lseek = dev_lseek_default, }; -static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char *val) +static int mtd_partition_set(struct param_d *p, void *priv) { - struct mtd_info *mtd = container_of(dev, struct mtd_info, class_dev); + struct mtd_info *mtd = priv; struct mtd_info *mtdpart, *tmp; int ret; - if (!val) + if (!mtd->partition_string) return -EINVAL; list_for_each_entry_safe(mtdpart, tmp, &mtd->partitions, partitions_entry) { @@ -464,7 +464,7 @@ static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char return ret; } - return cmdlinepart_do_parse(mtd->cdev.name, val, mtd->size, CMDLINEPART_ADD_DEVNAME); + return cmdlinepart_do_parse(mtd->cdev.name, mtd->partition_string, mtd->size, CMDLINEPART_ADD_DEVNAME); } static char *print_size(uint64_t s) @@ -530,18 +530,18 @@ static int print_parts(char *buf, int bufsize, struct mtd_info *mtd) return ret; } -static const char *mtd_partition_get(struct device_d *dev, struct param_d *p) +static int mtd_partition_get(struct param_d *p, void *priv) { - struct mtd_info *mtd = container_of(dev, struct mtd_info, class_dev); + struct mtd_info *mtd = priv; int len = 0; - free(p->value); + free(mtd->partition_string); len = print_parts(NULL, 0, mtd); - p->value = xzalloc(len + 1); - print_parts(p->value, len + 1, mtd); + mtd->partition_string = xzalloc(len + 1); + print_parts(mtd->partition_string, len + 1, mtd); - return p->value; + return 0; } static int mtd_part_compare(struct list_head *a, struct list_head *b) @@ -637,10 +637,10 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) mtd->cdev.mtd = mtd; if (IS_ENABLED(CONFIG_PARAMETER)) { - dev_add_param_llint_ro(&mtd->class_dev, "size", mtd->size, "%llu"); - dev_add_param_int_ro(&mtd->class_dev, "erasesize", mtd->erasesize, "%u"); - dev_add_param_int_ro(&mtd->class_dev, "writesize", mtd->writesize, "%u"); - dev_add_param_int_ro(&mtd->class_dev, "oobsize", mtd->oobsize, "%u"); + dev_add_param_uint64_ro(&mtd->class_dev, "size", &mtd->size, "%llu"); + dev_add_param_uint32_ro(&mtd->class_dev, "erasesize", &mtd->erasesize, "%u"); + dev_add_param_uint32_ro(&mtd->class_dev, "writesize", &mtd->writesize, "%u"); + dev_add_param_uint32_ro(&mtd->class_dev, "oobsize", &mtd->oobsize, "%u"); } ret = devfs_create(&mtd->cdev); @@ -667,7 +667,7 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) mtd->cdev_bb = mtd_add_bb(mtd, NULL); if (mtd->parent && !mtd->master) { - dev_add_param(&mtd->class_dev, "partitions", mtd_partition_set, mtd_partition_get, 0); + dev_add_param_string(&mtd->class_dev, "partitions", mtd_partition_set, mtd_partition_get, &mtd->partition_string, mtd); of_parse_partitions(&mtd->cdev, mtd->parent->device_node); if (IS_ENABLED(CONFIG_OFDEVICE) && mtd->parent->device_node) { mtd->of_path = xstrdup(mtd->parent->device_node->full_name); diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ceb2bb7215..d9f79474cd 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3853,25 +3853,40 @@ static int mtd_set_erasebad(struct param_d *param, void *priv) return 0; } -static const char *mtd_get_bbt_type(struct device_d *dev, struct param_d *p) +enum bbt_type { + BBT_TYPE_NONE = 0, + BBT_TYPE_FLASHBASED, + BBT_TYPE_MEMORYBASED, +}; + +static const char *bbt_type_strings[] = { + [BBT_TYPE_NONE] = "none", + [BBT_TYPE_FLASHBASED] = "flashbased", + [BBT_TYPE_MEMORYBASED] = "memorybased", +}; + +static int mtd_get_bbt_type(struct param_d *p, void *priv) { - struct mtd_info *mtd = container_of(dev, struct mtd_info, class_dev); + struct mtd_info *mtd = priv; struct nand_chip *chip = mtd->priv; - const char *str; + enum bbt_type type; if (!chip->bbt) - str = "none"; + type = BBT_TYPE_NONE; else if ((chip->bbt_td && chip->bbt_td->pages[0] != -1) || (chip->bbt_md && chip->bbt_md->pages[0] != -1)) - str = "flashbased"; + type = BBT_TYPE_FLASHBASED; else - str = "memorybased"; + type = BBT_TYPE_MEMORYBASED; + + chip->bbt_type = type; - return str; + return 0; } int add_mtd_nand_device(struct mtd_info *mtd, char *devname) { + struct nand_chip *chip = mtd->priv; int ret; ret = add_mtd_device(mtd, devname, DEVICE_ID_DYNAMIC); @@ -3882,7 +3897,10 @@ int add_mtd_nand_device(struct mtd_info *mtd, char *devname) dev_add_param_bool(&mtd->class_dev, "erasebad", mtd_set_erasebad, NULL, &mtd->p_allow_erasebad, mtd); - dev_add_param(&mtd->class_dev, "bbt", NULL, mtd_get_bbt_type, 0); + dev_add_param_enum(&mtd->class_dev, "bbt", NULL, mtd_get_bbt_type, + &chip->bbt_type, bbt_type_strings, + ARRAY_SIZE(bbt_type_strings), + mtd); return ret; } diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c index c35b63f2fd..0e64fe1671 100644 --- a/drivers/mtd/peb.c +++ b/drivers/mtd/peb.c @@ -76,11 +76,11 @@ static int mtd_peb_emulate_erase_failure(void) #ifdef CONFIG_MTD_PEB_DEBUG static int mtd_peb_debug_init(void) { - globalvar_add_simple_int("mtd_peb.mtd_peb_emulate_bitflip", + globalvar_add_simple_uint32("mtd_peb.mtd_peb_emulate_bitflip", &__mtd_peb_emulate_bitflip, "%u"); - globalvar_add_simple_int("mtd_peb.mtd_peb_emulate_write_failure", + globalvar_add_simple_uint32("mtd_peb.mtd_peb_emulate_write_failure", &__mtd_peb_emulate_write_failure, "%u"); - globalvar_add_simple_int("mtd_peb.mtd_peb_emulate_erase_failures", + globalvar_add_simple_uint32("mtd_peb.mtd_peb_emulate_erase_failures", &__mtd_peb_emulate_erase_failures, "%u"); globalvar_add_simple_bool("mtd_peb.mtd_peb_chk_io", &__mtd_peb_chk_io); diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 2ea66ed067..40fa890c9e 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -656,17 +656,17 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, ubi_msg(ubi, "available PEBs: %d, total reserved PEBs: %d, PEBs reserved for bad PEB handling: %d", ubi->avail_pebs, ubi->rsvd_pebs, ubi->beb_rsvd_pebs); - dev_add_param_int_ro(&ubi->dev, "peb_size", ubi->peb_size, "%d"); - dev_add_param_int_ro(&ubi->dev, "leb_size", ubi->leb_size, "%d"); - dev_add_param_int_ro(&ubi->dev, "vid_header_offset", ubi->vid_hdr_offset, "%d"); - dev_add_param_int_ro(&ubi->dev, "min_io_size", ubi->min_io_size, "%d"); - dev_add_param_int_ro(&ubi->dev, "sub_page_size", ubi->hdrs_min_io_size, "%d"); - dev_add_param_int_ro(&ubi->dev, "good_peb_count", ubi->good_peb_count, "%d"); - dev_add_param_int_ro(&ubi->dev, "bad_peb_count", ubi->bad_peb_count, "%d"); - dev_add_param_int_ro(&ubi->dev, "max_erase_counter", ubi->max_ec, "%d"); - dev_add_param_int_ro(&ubi->dev, "mean_erase_counter", ubi->mean_ec, "%d"); - dev_add_param_int_ro(&ubi->dev, "available_pebs", ubi->avail_pebs, "%d"); - dev_add_param_int_ro(&ubi->dev, "reserved_pebs", ubi->rsvd_pebs, "%d"); + dev_add_param_uint32_ro(&ubi->dev, "peb_size", &ubi->peb_size, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "leb_size", &ubi->leb_size, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "vid_header_offset", &ubi->vid_hdr_offset, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "min_io_size", &ubi->min_io_size, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "sub_page_size", &ubi->hdrs_min_io_size, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "good_peb_count", &ubi->good_peb_count, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "bad_peb_count", &ubi->bad_peb_count, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "max_erase_counter", &ubi->max_ec, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "mean_erase_counter", &ubi->mean_ec, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "available_pebs", &ubi->avail_pebs, "%u"); + dev_add_param_uint32_ro(&ubi->dev, "reserved_pebs", &ubi->rsvd_pebs, "%u"); ubi_devices[ubi_num] = ubi; diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 41bf018141..012b90e834 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -330,8 +330,8 @@ static int mdio_bus_probe(struct device_d *_dev) of_set_phy_supported(dev); dev->advertising = dev->supported; - dev_add_param_int_ro(&dev->dev, "phy_addr", dev->addr, "%d"); - dev_add_param_int_ro(&dev->dev, "phy_id", dev->phy_id, "0x%08x"); + dev_add_param_uint32_ro(&dev->dev, "phy_addr", &dev->addr, "%u"); + dev_add_param_uint32_ro(&dev->dev, "phy_id", &dev->phy_id, "0x%08x"); dev->cdev.name = xasprintf("mdio%d-phy%02x", dev->bus->dev.id, diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c index ee65619c4e..80fade0611 100644 --- a/drivers/pwm/core.c +++ b/drivers/pwm/core.c @@ -99,12 +99,12 @@ int pwmchip_add(struct pwm_chip *chip, struct device_d *dev) list_add_tail(&pwm->node, &pwm_list); - p = dev_add_param_int(&pwm->dev, "duty_ns", set_duty_period_ns, + p = dev_add_param_uint32(&pwm->dev, "duty_ns", set_duty_period_ns, NULL, &pwm->chip->duty_ns, "%u", pwm); if (IS_ERR(p)) return PTR_ERR(p); - p = dev_add_param_int(&pwm->dev, "period_ns", set_duty_period_ns, + p = dev_add_param_uint32(&pwm->dev, "period_ns", set_duty_period_ns, NULL, &pwm->chip->period_ns, "%u", pwm); if (IS_ERR(p)) return PTR_ERR(p); diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index aba2da0ad3..9170ba4d53 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -447,19 +447,19 @@ int usb_new_device(struct usb_device *dev) goto err_out; } - dev_add_param_int_ro(&dev->dev, "iManufacturer", - dev->descriptor->iManufacturer, "%d"); - dev_add_param_int_ro(&dev->dev, "iProduct", - dev->descriptor->iProduct, "%d"); - dev_add_param_int_ro(&dev->dev, "iSerialNumber", - dev->descriptor->iSerialNumber, "%d"); + dev_add_param_uint32_fixed(&dev->dev, "iManufacturer", + dev->descriptor->iManufacturer, "%u"); + dev_add_param_uint32_fixed(&dev->dev, "iProduct", + dev->descriptor->iProduct, "%u"); + dev_add_param_uint32_fixed(&dev->dev, "iSerialNumber", + dev->descriptor->iSerialNumber, "%u"); dev_add_param_fixed(&dev->dev, "iSerialNumber", str); dev_add_param_fixed(&dev->dev, "Manufacturer", dev->mf); dev_add_param_fixed(&dev->dev, "Product", dev->prod); dev_add_param_fixed(&dev->dev, "SerialNumber", dev->serial); - dev_add_param_int_ro(&dev->dev, "idVendor", + dev_add_param_uint32_fixed(&dev->dev, "idVendor", dev->descriptor->idVendor, "%04x"); - dev_add_param_int_ro(&dev->dev, "idProduct", + dev_add_param_uint32_fixed(&dev->dev, "idProduct", dev->descriptor->idProduct, "%04x"); list_add_tail(&dev->list, &usb_device_list); dev_count++; diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 4f001e102f..ed99b53df7 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c @@ -187,9 +187,9 @@ int usb_add_gadget_udc_release(struct device_d *parent, struct usb_gadget *gadge if (ret) goto err2; - dev_add_param_int(&gadget->dev, "product", NULL, NULL, + dev_add_param_uint32(&gadget->dev, "product", NULL, NULL, &gadget->product_id, "0x%04x", NULL); - dev_add_param_int(&gadget->dev, "vendor", NULL, NULL, + dev_add_param_uint32(&gadget->dev, "vendor", NULL, NULL, &gadget->vendor_id, "0x%04x", NULL); gadget->manufacturer = xstrdup("barebox"); dev_add_param_string(&gadget->dev, "manufacturer", NULL, NULL, diff --git a/drivers/video/backlight.c b/drivers/video/backlight.c index ddde6f8523..09c0e47af6 100644 --- a/drivers/video/backlight.c +++ b/drivers/video/backlight.c @@ -70,7 +70,7 @@ int backlight_register(struct backlight_device *bl) if (ret) return ret; - dev_add_param_int(&bl->dev, "brightness", backlight_brightness_set, + dev_add_param_uint32(&bl->dev, "brightness", backlight_brightness_set, NULL, &bl->brightness, "%d", bl); list_add_tail(&bl->list, &backlights); diff --git a/drivers/video/imx-ipu-fb.c b/drivers/video/imx-ipu-fb.c index 7c3a800149..9cc7a911ea 100644 --- a/drivers/video/imx-ipu-fb.c +++ b/drivers/video/imx-ipu-fb.c @@ -978,7 +978,7 @@ static int sdc_fb_register_overlay(struct ipu_fb_info *fbi, void *fb) return ret; } - dev_add_param_int(&overlay->dev, "alpha", sdc_alpha_set, + dev_add_param_uint32(&overlay->dev, "alpha", sdc_alpha_set, NULL, &fbi->alpha, "%u", overlay); return 0; diff --git a/drivers/video/imx.c b/drivers/video/imx.c index 78cb5c0ca2..947f8d5349 100644 --- a/drivers/video/imx.c +++ b/drivers/video/imx.c @@ -530,7 +530,7 @@ static int imxfb_register_overlay(struct imxfb_info *fbi, void *fb) return ret; } - dev_add_param_int(&overlay->dev, "alpha", imxfb_alpha_set, + dev_add_param_uint32(&overlay->dev, "alpha", imxfb_alpha_set, NULL, &fbi->alpha, "%u", overlay); return 0; |