text
stringlengths 213
7.14k
| idx
int64 16
12.5k
|
---|---|
--- initial
+++ final
@@ -1,25 +1,22 @@
static int tz1090_pdc_pinctrl_probe(struct platform_device *pdev) {
struct tz1090_pdc_pmx *pmx;
struct resource *res;
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
- if (!pmx) {
- dev_err(&pdev->dev, "Can't alloc tz1090_pdc_pmx\n");
- return -ENOMEM;
- }
+ if (!pmx) return -ENOMEM;
pmx->dev = &pdev->dev;
spin_lock_init(&pmx->lock);
tz1090_pdc_pinctrl_desc.name = dev_name(&pdev->dev);
tz1090_pdc_pinctrl_desc.pins = tz1090_pdc_pins;
tz1090_pdc_pinctrl_desc.npins = ARRAY_SIZE(tz1090_pdc_pins);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pmx->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->regs)) return PTR_ERR(pmx->regs);
pmx->pctl = devm_pinctrl_register(&pdev->dev, &tz1090_pdc_pinctrl_desc, pmx);
if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pmx->pctl);
}
platform_set_drvdata(pdev, pmx);
dev_info(&pdev->dev, "TZ1090 PDC pinctrl driver initialised\n");
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 46 |
--- initial
+++ final
@@ -1,62 +1,59 @@
static int cs42l73_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
struct cs42l73_private *cs42l73;
struct cs42l73_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
int ret;
unsigned int devid = 0;
unsigned int reg;
u32 val32;
cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), GFP_KERNEL);
if (!cs42l73) return -ENOMEM;
cs42l73->regmap = devm_regmap_init_i2c(i2c_client, &cs42l73_regmap);
if (IS_ERR(cs42l73->regmap)) {
ret = PTR_ERR(cs42l73->regmap);
dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
return ret;
}
if (pdata) {
cs42l73->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_platform_data), GFP_KERNEL);
- if (!pdata) {
- dev_err(&i2c_client->dev, "could not allocate pdata\n");
- return -ENOMEM;
- }
+ if (!pdata) return -ENOMEM;
if (i2c_client->dev.of_node) {
if (of_property_read_u32(i2c_client->dev.of_node, "chgfreq", &val32) >= 0) pdata->chgfreq = val32;
}
pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "reset-gpio", 0);
cs42l73->pdata = *pdata;
}
i2c_set_clientdata(i2c_client, cs42l73);
if (cs42l73->pdata.reset_gpio) {
ret = devm_gpio_request_one(&i2c_client->dev, cs42l73->pdata.reset_gpio, GPIOF_OUT_INIT_HIGH, "CS42L73 /RST");
if (ret < 0) {
dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l73->pdata.reset_gpio, ret);
return ret;
}
gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 0);
gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 1);
}
/* initialize codec */
ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, ®);
devid = (reg & 0xFF) << 12;
ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, ®);
devid |= (reg & 0xFF) << 4;
ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, ®);
devid |= (reg & 0xF0) >> 4;
if (devid != CS42L73_DEVID) {
ret = -ENODEV;
dev_err(&i2c_client->dev, "CS42L73 Device ID (%X). Expected %X\n", devid, CS42L73_DEVID);
return ret;
}
ret = regmap_read(cs42l73->regmap, CS42L73_REVID, ®);
if (ret < 0) {
dev_err(&i2c_client->dev, "Get Revision ID failed\n");
return ret;
;
}
dev_info(&i2c_client->dev, "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF);
ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l73, cs42l73_dai, ARRAY_SIZE(cs42l73_dai));
if (ret < 0) return ret;
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 16 |
--- initial
+++ final
@@ -1,42 +1,39 @@
static int palmas_pinctrl_probe(struct platform_device *pdev) {
struct palmas_pctrl_chip_info *pci;
const struct palmas_pinctrl_data *pinctrl_data = &tps65913_pinctrl_data;
int ret;
bool enable_dvfs1 = false;
bool enable_dvfs2 = false;
if (pdev->dev.of_node) {
pinctrl_data = of_device_get_match_data(&pdev->dev);
enable_dvfs1 = of_property_read_bool(pdev->dev.of_node, "ti,palmas-enable-dvfs1");
enable_dvfs2 = of_property_read_bool(pdev->dev.of_node, "ti,palmas-enable-dvfs2");
}
pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL);
- if (!pci) {
- dev_err(&pdev->dev, "Malloc for pci failed\n");
- return -ENOMEM;
- }
+ if (!pci) return -ENOMEM;
pci->dev = &pdev->dev;
pci->palmas = dev_get_drvdata(pdev->dev.parent);
pci->pins = palmas_pins_desc;
pci->num_pins = ARRAY_SIZE(palmas_pins_desc);
pci->functions = palmas_pin_function;
pci->num_functions = ARRAY_SIZE(palmas_pin_function);
pci->pin_groups = pinctrl_data->pin_groups;
pci->num_pin_groups = pinctrl_data->num_pin_groups;
platform_set_drvdata(pdev, pci);
palmas_pinctrl_set_dvfs1(pci, enable_dvfs1);
palmas_pinctrl_set_dvfs2(pci, enable_dvfs2);
ret = palmas_pinctrl_get_pin_mux(pci);
if (ret < 0) {
dev_err(&pdev->dev, "Reading pinctrol option register failed: %d\n", ret);
return ret;
}
palmas_pinctrl_desc.name = dev_name(&pdev->dev);
palmas_pinctrl_desc.pins = palmas_pins_desc;
palmas_pinctrl_desc.npins = ARRAY_SIZE(palmas_pins_desc);
pci->pctl = devm_pinctrl_register(&pdev->dev, &palmas_pinctrl_desc, pci);
if (IS_ERR(pci->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pci->pctl);
}
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 38 |
--- initial
+++ final
@@ -1,15 +1,12 @@
int pinctrl_utils_add_map_configs(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *reserved_maps, unsigned *num_maps, const char *group, unsigned long *configs, unsigned num_configs, enum pinctrl_map_type type) {
unsigned long *dup_configs;
if (WARN_ON(*num_maps == *reserved_maps)) return -ENOSPC;
dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs), GFP_KERNEL);
- if (!dup_configs) {
- dev_err(pctldev->dev, "kmemdup(configs) failed\n");
- return -ENOMEM;
- }
+ if (!dup_configs) return -ENOMEM;
(*map)[*num_maps].type = type;
(*map)[*num_maps].data.configs.group_or_pin = group;
(*map)[*num_maps].data.configs.configs = dup_configs;
(*map)[*num_maps].data.configs.num_configs = num_configs;
(*num_maps)++;
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 47 |
--- initial
+++ final
@@ -1,143 +1,140 @@
int mvebu_pinctrl_probe(struct platform_device *pdev) {
struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev);
struct mvebu_pinctrl *pctl;
struct pinctrl_pin_desc *pdesc;
unsigned gid, n, k;
unsigned size, noname = 0;
char *noname_buf;
void *p;
int ret;
if (!soc || !soc->controls || !soc->modes) {
dev_err(&pdev->dev, "wrong pinctrl soc info\n");
return -EINVAL;
}
pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl), GFP_KERNEL);
if (!pctl) return -ENOMEM;
pctl->desc.name = dev_name(&pdev->dev);
pctl->desc.owner = THIS_MODULE;
pctl->desc.pctlops = &mvebu_pinctrl_ops;
pctl->desc.pmxops = &mvebu_pinmux_ops;
pctl->desc.confops = &mvebu_pinconf_ops;
pctl->variant = soc->variant;
pctl->dev = &pdev->dev;
platform_set_drvdata(pdev, pctl);
/* count controls and create names for mvebu generic
register controls; also does sanity checks */
pctl->num_groups = 0;
pctl->desc.npins = 0;
for (n = 0; n < soc->ncontrols; n++) {
const struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];
pctl->desc.npins += ctrl->npins;
/* initialize control's pins[] array */
for (k = 0; k < ctrl->npins; k++)
ctrl->pins[k] = ctrl->pid + k;
/*
* We allow to pass controls with NULL name that we treat
* as a range of one-pin groups with generic mvebu register
* controls.
*/
if (!ctrl->name) {
pctl->num_groups += ctrl->npins;
noname += ctrl->npins;
} else {
pctl->num_groups += 1;
}
}
pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins * sizeof(struct pinctrl_pin_desc), GFP_KERNEL);
if (!pdesc) return -ENOMEM;
for (n = 0; n < pctl->desc.npins; n++)
pdesc[n].number = n;
pctl->desc.pins = pdesc;
/*
* allocate groups and name buffers for unnamed groups.
*/
size = pctl->num_groups * sizeof(*pctl->groups) + noname * 8;
p = devm_kzalloc(&pdev->dev, size, GFP_KERNEL);
- if (!p) {
- dev_err(&pdev->dev, "failed to alloc group data\n");
- return -ENOMEM;
- }
+ if (!p) return -ENOMEM;
pctl->groups = p;
noname_buf = p + pctl->num_groups * sizeof(*pctl->groups);
/* assign mpp controls to groups */
gid = 0;
for (n = 0; n < soc->ncontrols; n++) {
const struct mvebu_mpp_ctrl *ctrl = &soc->controls[n];
struct mvebu_mpp_ctrl_data *data = soc->control_data ? &soc->control_data[n] : NULL;
pctl->groups[gid].gid = gid;
pctl->groups[gid].ctrl = ctrl;
pctl->groups[gid].data = data;
pctl->groups[gid].name = ctrl->name;
pctl->groups[gid].pins = ctrl->pins;
pctl->groups[gid].npins = ctrl->npins;
/*
* We treat unnamed controls as a range of one-pin groups
* with generic mvebu register controls. Use one group for
* each in this range and assign a default group name.
*/
if (!ctrl->name) {
pctl->groups[gid].name = noname_buf;
pctl->groups[gid].npins = 1;
sprintf(noname_buf, "mpp%d", ctrl->pid + 0);
noname_buf += 8;
for (k = 1; k < ctrl->npins; k++) {
gid++;
pctl->groups[gid].gid = gid;
pctl->groups[gid].ctrl = ctrl;
pctl->groups[gid].data = data;
pctl->groups[gid].name = noname_buf;
pctl->groups[gid].pins = &ctrl->pins[k];
pctl->groups[gid].npins = 1;
sprintf(noname_buf, "mpp%d", ctrl->pid + k);
noname_buf += 8;
}
}
gid++;
}
/* assign mpp modes to groups */
for (n = 0; n < soc->nmodes; n++) {
struct mvebu_mpp_mode *mode = &soc->modes[n];
struct mvebu_mpp_ctrl_setting *set = &mode->settings[0];
struct mvebu_pinctrl_group *grp;
unsigned num_settings;
unsigned supp_settings;
for (num_settings = 0, supp_settings = 0;; set++) {
if (!set->name) break;
num_settings++;
/* skip unsupported settings for this variant */
if (pctl->variant && !(pctl->variant & set->variant)) continue;
supp_settings++;
/* find gpio/gpo/gpi settings */
if (strcmp(set->name, "gpio") == 0)
set->flags = MVEBU_SETTING_GPI | MVEBU_SETTING_GPO;
else if (strcmp(set->name, "gpo") == 0)
set->flags = MVEBU_SETTING_GPO;
else if (strcmp(set->name, "gpi") == 0)
set->flags = MVEBU_SETTING_GPI;
}
/* skip modes with no settings for this variant */
if (!supp_settings) continue;
grp = mvebu_pinctrl_find_group_by_pid(pctl, mode->pid);
if (!grp) {
dev_warn(&pdev->dev, "unknown pinctrl group %d\n", mode->pid);
continue;
}
grp->settings = mode->settings;
grp->num_settings = num_settings;
}
ret = mvebu_pinctrl_build_functions(pdev, pctl);
if (ret) {
dev_err(&pdev->dev, "unable to build functions\n");
return ret;
}
pctl->pctldev = devm_pinctrl_register(&pdev->dev, &pctl->desc, pctl);
if (IS_ERR(pctl->pctldev)) {
dev_err(&pdev->dev, "unable to register pinctrl driver\n");
return PTR_ERR(pctl->pctldev);
}
dev_info(&pdev->dev, "registered pinctrl driver\n");
/* register gpio ranges */
for (n = 0; n < soc->ngpioranges; n++)
pinctrl_add_gpio_range(pctl->pctldev, &soc->gpioranges[n]);
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 34 |
--- initial
+++ final
@@ -1,25 +1,22 @@
static int tz1090_pinctrl_probe(struct platform_device *pdev) {
struct tz1090_pmx *pmx;
struct resource *res;
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
- if (!pmx) {
- dev_err(&pdev->dev, "Can't alloc tz1090_pmx\n");
- return -ENOMEM;
- }
+ if (!pmx) return -ENOMEM;
pmx->dev = &pdev->dev;
spin_lock_init(&pmx->lock);
tz1090_pinctrl_desc.name = dev_name(&pdev->dev);
tz1090_pinctrl_desc.pins = tz1090_pins;
tz1090_pinctrl_desc.npins = ARRAY_SIZE(tz1090_pins);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pmx->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->regs)) return PTR_ERR(pmx->regs);
pmx->pctl = devm_pinctrl_register(&pdev->dev, &tz1090_pinctrl_desc, pmx);
if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pmx->pctl);
}
platform_set_drvdata(pdev, pmx);
dev_info(&pdev->dev, "TZ1090 pinctrl driver initialised\n");
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 44 |
--- initial
+++ final
@@ -1,40 +1,37 @@
static struct se_portal_group *sbp_make_tpg(struct se_wwn *wwn, struct config_group *group, const char *name) {
struct sbp_tport *tport = container_of(wwn, struct sbp_tport, tport_wwn);
struct sbp_tpg *tpg;
unsigned long tpgt;
int ret;
if (strstr(name, "tpgt_") != name) return ERR_PTR(-EINVAL);
if (kstrtoul(name + 5, 10, &tpgt) || tpgt > UINT_MAX) return ERR_PTR(-EINVAL);
if (tport->tpg) {
pr_err("Only one TPG per Unit is possible.\n");
return ERR_PTR(-EBUSY);
}
tpg = kzalloc(sizeof(*tpg), GFP_KERNEL);
- if (!tpg) {
- pr_err("Unable to allocate struct sbp_tpg\n");
- return ERR_PTR(-ENOMEM);
- }
+ if (!tpg) return ERR_PTR(-ENOMEM);
tpg->tport = tport;
tpg->tport_tpgt = tpgt;
tport->tpg = tpg;
/* default attribute values */
tport->enable = 0;
tport->directory_id = -1;
tport->mgt_orb_timeout = 15;
tport->max_reconnect_timeout = 5;
tport->max_logins_per_lun = 1;
tport->mgt_agt = sbp_management_agent_register(tport);
if (IS_ERR(tport->mgt_agt)) {
ret = PTR_ERR(tport->mgt_agt);
goto out_free_tpg;
}
ret = core_tpg_register(wwn, &tpg->se_tpg, SCSI_PROTOCOL_SBP);
if (ret < 0) goto out_unreg_mgt_agt;
return &tpg->se_tpg;
out_unreg_mgt_agt:
sbp_management_agent_unregister(tport->mgt_agt);
out_free_tpg:
tport->tpg = NULL;
kfree(tpg);
return ERR_PTR(ret);
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 26 |
--- initial
+++ final
@@ -1,70 +1,66 @@
static int __init alloc_bus_range(struct bus_node **new_bus, struct range_node **new_range, struct ebda_pci_rsrc *curr, int flag, u8 first_bus) {
struct bus_node *newbus;
struct range_node *newrange;
u8 num_ranges = 0;
if (first_bus) {
newbus = kzalloc(sizeof(struct bus_node), GFP_KERNEL);
- if (!newbus) {
- err("out of system memory.\n");
- return -ENOMEM;
- }
+ if (!newbus) return -ENOMEM;
newbus->busno = curr->bus_num;
} else {
newbus = *new_bus;
switch (flag) {
case MEM: num_ranges = newbus->noMemRanges; break;
case PFMEM: num_ranges = newbus->noPFMemRanges; break;
case IO: num_ranges = newbus->noIORanges; break;
}
}
newrange = kzalloc(sizeof(struct range_node), GFP_KERNEL);
if (!newrange) {
if (first_bus) kfree(newbus);
- err("out of system memory\n");
return -ENOMEM;
}
newrange->start = curr->start_addr;
newrange->end = curr->end_addr;
if (first_bus || (!num_ranges))
newrange->rangeno = 1;
else {
/* need to insert our range */
add_bus_range(flag, newrange, newbus);
debug("%d resource Primary Bus inserted on bus %x [%x - %x]\n", flag, newbus->busno, newrange->start, newrange->end);
}
switch (flag) {
case MEM:
newbus->rangeMem = newrange;
if (first_bus)
newbus->noMemRanges = 1;
else {
debug("First Memory Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
++newbus->noMemRanges;
fix_resources(newbus);
}
break;
case IO:
newbus->rangeIO = newrange;
if (first_bus)
newbus->noIORanges = 1;
else {
debug("First IO Primary on bus %x, [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
++newbus->noIORanges;
fix_resources(newbus);
}
break;
case PFMEM:
newbus->rangePFMem = newrange;
if (first_bus)
newbus->noPFMemRanges = 1;
else {
debug("1st PFMemory Primary on Bus %x [%x - %x]\n", newbus->busno, newrange->start, newrange->end);
++newbus->noPFMemRanges;
fix_resources(newbus);
}
break;
}
*new_bus = newbus;
*new_range = newrange;
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 69 |
--- initial
+++ final
@@ -1,62 +1,59 @@
static int cs42l52_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
struct cs42l52_private *cs42l52;
struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
int ret;
unsigned int devid = 0;
unsigned int reg;
u32 val32;
cs42l52 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_private), GFP_KERNEL);
if (cs42l52 == NULL) return -ENOMEM;
cs42l52->dev = &i2c_client->dev;
cs42l52->regmap = devm_regmap_init_i2c(i2c_client, &cs42l52_regmap);
if (IS_ERR(cs42l52->regmap)) {
ret = PTR_ERR(cs42l52->regmap);
dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
return ret;
}
if (pdata) {
cs42l52->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l52_platform_data), GFP_KERNEL);
- if (!pdata) {
- dev_err(&i2c_client->dev, "could not allocate pdata\n");
- return -ENOMEM;
- }
+ if (!pdata) return -ENOMEM;
if (i2c_client->dev.of_node) {
if (of_property_read_bool(i2c_client->dev.of_node, "cirrus,mica-differential-cfg")) pdata->mica_diff_cfg = true;
if (of_property_read_bool(i2c_client->dev.of_node, "cirrus,micb-differential-cfg")) pdata->micb_diff_cfg = true;
if (of_property_read_u32(i2c_client->dev.of_node, "cirrus,micbias-lvl", &val32) >= 0) pdata->micbias_lvl = val32;
if (of_property_read_u32(i2c_client->dev.of_node, "cirrus,chgfreq-divisor", &val32) >= 0) pdata->chgfreq = val32;
pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "cirrus,reset-gpio", 0);
}
cs42l52->pdata = *pdata;
}
if (cs42l52->pdata.reset_gpio) {
ret = devm_gpio_request_one(&i2c_client->dev, cs42l52->pdata.reset_gpio, GPIOF_OUT_INIT_HIGH, "CS42L52 /RST");
if (ret < 0) {
dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l52->pdata.reset_gpio, ret);
return ret;
}
gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
}
i2c_set_clientdata(i2c_client, cs42l52);
ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch, ARRAY_SIZE(cs42l52_threshold_patch));
if (ret != 0) dev_warn(cs42l52->dev, "Failed to apply regmap patch: %d\n", ret);
ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, ®);
devid = reg & CS42L52_CHIP_ID_MASK;
if (devid != CS42L52_CHIP_ID) {
ret = -ENODEV;
dev_err(&i2c_client->dev, "CS42L52 Device ID (%X). Expected %X\n", devid, CS42L52_CHIP_ID);
return ret;
}
dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n", reg & CS42L52_CHIP_REV_MASK);
/* Set Platform Data */
if (cs42l52->pdata.mica_diff_cfg) regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL, CS42L52_MIC_CTL_TYPE_MASK, cs42l52->pdata.mica_diff_cfg << CS42L52_MIC_CTL_TYPE_SHIFT);
if (cs42l52->pdata.micb_diff_cfg) regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL, CS42L52_MIC_CTL_TYPE_MASK, cs42l52->pdata.micb_diff_cfg << CS42L52_MIC_CTL_TYPE_SHIFT);
if (cs42l52->pdata.chgfreq) regmap_update_bits(cs42l52->regmap, CS42L52_CHARGE_PUMP, CS42L52_CHARGE_PUMP_MASK, cs42l52->pdata.chgfreq << CS42L52_CHARGE_PUMP_SHIFT);
if (cs42l52->pdata.micbias_lvl) regmap_update_bits(cs42l52->regmap, CS42L52_IFACE_CTL2, CS42L52_IFACE_CTL2_BIAS_LVL, cs42l52->pdata.micbias_lvl);
ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l52, &cs42l52_dai, 1);
if (ret < 0) return ret;
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 20 |
--- initial
+++ final
@@ -1,136 +1,134 @@
static void sbp_management_request_login(struct sbp_management_agent *agent, struct sbp_management_request *req, int *status_data_size) {
struct sbp_tport *tport = agent->tport;
struct sbp_tpg *tpg = tport->tpg;
struct sbp_session *sess;
struct sbp_login_descriptor *login;
struct sbp_login_response_block *response;
u64 guid;
u32 unpacked_lun;
int login_response_len, ret;
unpacked_lun = sbp_get_lun_from_tpg(tpg, LOGIN_ORB_LUN(be32_to_cpu(req->orb.misc)), &ret);
if (ret) {
pr_notice("login to unknown LUN: %d\n", LOGIN_ORB_LUN(be32_to_cpu(req->orb.misc)));
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_LUN_NOTSUPP));
return;
}
ret = read_peer_guid(&guid, req);
if (ret != RCODE_COMPLETE) {
pr_warn("failed to read peer GUID: %d\n", ret);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
return;
}
pr_notice("mgt_agent LOGIN to LUN %d from %016llx\n", unpacked_lun, guid);
sess = sbp_session_find_by_guid(tpg, guid);
if (sess) {
login = sbp_login_find_by_lun(sess, unpacked_lun);
if (login) {
pr_notice("initiator already logged-in\n");
/*
* SBP-2 R4 says we should return access denied, but
* that can confuse initiators. Instead we need to
* treat this like a reconnect, but send the login
* response block like a fresh login.
*
* This is required particularly in the case of Apple
* devices booting off the FireWire target, where
* the firmware has an active login to the target. When
* the OS takes control of the session it issues its own
* LOGIN rather than a RECONNECT. To avoid the machine
* waiting until the reconnect_hold expires, we can skip
* the ACCESS_DENIED errors to speed things up.
*/
goto already_logged_in;
}
}
/*
* check exclusive bit in login request
* reject with access_denied if any logins present
*/
if (LOGIN_ORB_EXCLUSIVE(be32_to_cpu(req->orb.misc)) && sbp_login_count_all_by_lun(tpg, unpacked_lun, 0)) {
pr_warn("refusing exclusive login with other active logins\n");
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_ACCESS_DENIED));
return;
}
/*
* check exclusive bit in any existing login descriptor
* reject with access_denied if any exclusive logins present
*/
if (sbp_login_count_all_by_lun(tpg, unpacked_lun, 1)) {
pr_warn("refusing login while another exclusive login present\n");
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_ACCESS_DENIED));
return;
}
/*
* check we haven't exceeded the number of allowed logins
* reject with resources_unavailable if we have
*/
if (sbp_login_count_all_by_lun(tpg, unpacked_lun, 0) >= tport->max_logins_per_lun) {
pr_warn("max number of logins reached\n");
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_RESOURCES_UNAVAIL));
return;
}
if (!sess) {
sess = sbp_session_create(tpg, guid);
if (IS_ERR(sess)) {
switch (PTR_ERR(sess)) {
case -EPERM: ret = SBP_STATUS_ACCESS_DENIED; break;
default: ret = SBP_STATUS_RESOURCES_UNAVAIL; break;
}
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(ret));
return;
}
sess->node_id = req->node_addr;
sess->card = fw_card_get(req->card);
sess->generation = req->generation;
sess->speed = req->speed;
schedule_delayed_work(&sess->maint_work, SESSION_MAINTENANCE_INTERVAL);
}
/* only take the latest reconnect_hold into account */
sess->reconnect_hold = min(1 << LOGIN_ORB_RECONNECT(be32_to_cpu(req->orb.misc)), tport->max_reconnect_timeout) - 1;
login = kmalloc(sizeof(*login), GFP_KERNEL);
if (!login) {
- pr_err("failed to allocate login descriptor\n");
sbp_session_release(sess, true);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_RESOURCES_UNAVAIL));
return;
}
login->sess = sess;
login->login_lun = unpacked_lun;
login->status_fifo_addr = sbp2_pointer_to_addr(&req->orb.status_fifo);
login->exclusive = LOGIN_ORB_EXCLUSIVE(be32_to_cpu(req->orb.misc));
login->login_id = atomic_inc_return(&login_id);
login->tgt_agt = sbp_target_agent_register(login);
if (IS_ERR(login->tgt_agt)) {
ret = PTR_ERR(login->tgt_agt);
pr_err("failed to map command block handler: %d\n", ret);
sbp_session_release(sess, true);
kfree(login);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_RESOURCES_UNAVAIL));
return;
}
spin_lock_bh(&sess->lock);
list_add_tail(&login->link, &sess->login_list);
spin_unlock_bh(&sess->lock);
already_logged_in:
response = kzalloc(sizeof(*response), GFP_KERNEL);
if (!response) {
- pr_err("failed to allocate login response block\n");
sbp_login_release(login, true);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_RESOURCES_UNAVAIL));
return;
}
login_response_len = clamp_val(LOGIN_ORB_RESPONSE_LENGTH(be32_to_cpu(req->orb.length)), 12, sizeof(*response));
response->misc = cpu_to_be32(((login_response_len & 0xffff) << 16) | (login->login_id & 0xffff));
response->reconnect_hold = cpu_to_be32(sess->reconnect_hold & 0xffff);
addr_to_sbp2_pointer(login->tgt_agt->handler.offset, &response->command_block_agent);
ret = sbp_run_transaction(sess->card, TCODE_WRITE_BLOCK_REQUEST, sess->node_id, sess->generation, sess->speed, sbp2_pointer_to_addr(&req->orb.ptr2), response, login_response_len);
if (ret != RCODE_COMPLETE) {
pr_debug("failed to write login response block: %x\n", ret);
kfree(response);
sbp_login_release(login, true);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_TRANSPORT_FAILURE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_UNSPECIFIED_ERROR));
return;
}
kfree(response);
req->status.status = cpu_to_be32(STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | STATUS_BLOCK_SBP_STATUS(SBP_STATUS_OK));
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 28 |
--- initial
+++ final
@@ -1,52 +1,43 @@
static int add_new_bus(struct bus_node *bus, struct resource_node *io, struct resource_node *mem, struct resource_node *pfmem, u8 parent_busno) {
struct range_node *io_range = NULL;
struct range_node *mem_range = NULL;
struct range_node *pfmem_range = NULL;
struct bus_node *cur_bus = NULL;
/* Trying to find the parent bus number */
if (parent_busno != 0xFF) {
cur_bus = ibmphp_find_res_bus(parent_busno);
if (!cur_bus) {
err("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n");
return -ENODEV;
}
list_add(&bus->bus_list, &cur_bus->bus_list);
}
if (io) {
io_range = kzalloc(sizeof(*io_range), GFP_KERNEL);
- if (!io_range) {
- err("out of system memory\n");
- return -ENOMEM;
- }
+ if (!io_range) return -ENOMEM;
io_range->start = io->start;
io_range->end = io->end;
io_range->rangeno = 1;
bus->noIORanges = 1;
bus->rangeIO = io_range;
}
if (mem) {
mem_range = kzalloc(sizeof(*mem_range), GFP_KERNEL);
- if (!mem_range) {
- err("out of system memory\n");
- return -ENOMEM;
- }
+ if (!mem_range) return -ENOMEM;
mem_range->start = mem->start;
mem_range->end = mem->end;
mem_range->rangeno = 1;
bus->noMemRanges = 1;
bus->rangeMem = mem_range;
}
if (pfmem) {
pfmem_range = kzalloc(sizeof(*pfmem_range), GFP_KERNEL);
- if (!pfmem_range) {
- err("out of system memory\n");
- return -ENOMEM;
- }
+ if (!pfmem_range) return -ENOMEM;
pfmem_range->start = pfmem->start;
pfmem_range->end = pfmem->end;
pfmem_range->rangeno = 1;
bus->noPFMemRanges = 1;
bus->rangePFMem = pfmem_range;
}
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 65 |
--- initial
+++ final
@@ -1,36 +1,33 @@
int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data) {
struct msm_pinctrl *pctrl;
struct resource *res;
int ret;
pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
- if (!pctrl) {
- dev_err(&pdev->dev, "Can't allocate msm_pinctrl\n");
- return -ENOMEM;
- }
+ if (!pctrl) return -ENOMEM;
pctrl->dev = &pdev->dev;
pctrl->soc = soc_data;
pctrl->chip = msm_gpio_template;
raw_spin_lock_init(&pctrl->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pctrl->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pctrl->regs)) return PTR_ERR(pctrl->regs);
msm_pinctrl_setup_pm_reset(pctrl);
pctrl->irq = platform_get_irq(pdev, 0);
if (pctrl->irq < 0) {
dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
return pctrl->irq;
}
msm_pinctrl_desc.name = dev_name(&pdev->dev);
msm_pinctrl_desc.pins = pctrl->soc->pins;
msm_pinctrl_desc.npins = pctrl->soc->npins;
pctrl->pctrl = devm_pinctrl_register(&pdev->dev, &msm_pinctrl_desc, pctrl);
if (IS_ERR(pctrl->pctrl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pctrl->pctrl);
}
ret = msm_gpio_init(pctrl);
if (ret) return ret;
platform_set_drvdata(pdev, pctrl);
dev_dbg(&pdev->dev, "Probed Qualcomm pinctrl driver\n");
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 49 |
--- initial
+++ final
@@ -1,51 +1,48 @@
static int exynos_trng_probe(struct platform_device *pdev) {
struct exynos_trng_dev *trng;
struct resource *res;
int ret = -ENOMEM;
trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL);
if (!trng) return ret;
trng->rng.name = devm_kstrdup(&pdev->dev, dev_name(&pdev->dev), GFP_KERNEL);
if (!trng->rng.name) return ret;
trng->rng.init = exynos_trng_init;
trng->rng.read = exynos_trng_do_read;
trng->rng.priv = (unsigned long)trng;
platform_set_drvdata(pdev, trng);
trng->dev = &pdev->dev;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
trng->mem = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(trng->mem)) {
- dev_err(&pdev->dev, "Could not map IO resources.\n");
- return PTR_ERR(trng->mem);
- }
+ if (IS_ERR(trng->mem)) return PTR_ERR(trng->mem);
pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
dev_err(&pdev->dev, "Could not get runtime PM.\n");
goto err_pm_get;
}
trng->clk = devm_clk_get(&pdev->dev, "secss");
if (IS_ERR(trng->clk)) {
ret = PTR_ERR(trng->clk);
dev_err(&pdev->dev, "Could not get clock.\n");
goto err_clock;
}
ret = clk_prepare_enable(trng->clk);
if (ret) {
dev_err(&pdev->dev, "Could not enable the clk.\n");
goto err_clock;
}
ret = hwrng_register(&trng->rng);
if (ret) {
dev_err(&pdev->dev, "Could not register hwrng device.\n");
goto err_register;
}
dev_info(&pdev->dev, "Exynos True Random Number Generator.\n");
return 0;
err_register:
clk_disable_unprepare(trng->clk);
err_clock:
pm_runtime_put_sync(&pdev->dev);
err_pm_get:
pm_runtime_disable(&pdev->dev);
return ret;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = devm_ioremap_resource(...);
if (IS_ERR(x))
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 84 |
--- initial
+++ final
@@ -1,37 +1,34 @@
int spear_pinctrl_probe(struct platform_device *pdev, struct spear_pinctrl_machdata *machdata) {
struct device_node *np = pdev->dev.of_node;
struct resource *res;
struct spear_pmx *pmx;
if (!machdata) return -ENODEV;
pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
- if (!pmx) {
- dev_err(&pdev->dev, "Can't alloc spear_pmx\n");
- return -ENOMEM;
- }
+ if (!pmx) return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pmx->vbase = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pmx->vbase)) return PTR_ERR(pmx->vbase);
pmx->dev = &pdev->dev;
pmx->machdata = machdata;
/* configure mode, if supported by SoC */
if (machdata->modes_supported) {
int mode = 0;
if (of_property_read_u32(np, "st,pinmux-mode", &mode)) {
dev_err(&pdev->dev, "OF: pinmux mode not passed\n");
return -EINVAL;
}
if (set_mode(pmx, mode)) {
dev_err(&pdev->dev, "OF: Couldn't configure mode: %x\n", mode);
return -EINVAL;
}
}
platform_set_drvdata(pdev, pmx);
spear_pinctrl_desc.pins = machdata->pins;
spear_pinctrl_desc.npins = machdata->npins;
pmx->pctl = devm_pinctrl_register(&pdev->dev, &spear_pinctrl_desc, pmx);
if (IS_ERR(pmx->pctl)) {
dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
return PTR_ERR(pmx->pctl);
}
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 51 |
--- initial
+++ final
@@ -1,159 +1,156 @@
static int init_cc_resources(struct platform_device *plat_dev) {
struct resource *req_mem_cc_regs = NULL;
struct cc_drvdata *new_drvdata;
struct device *dev = &plat_dev->dev;
struct device_node *np = dev->of_node;
u32 signature_val;
u64 dma_mask;
int rc = 0;
new_drvdata = devm_kzalloc(dev, sizeof(*new_drvdata), GFP_KERNEL);
if (!new_drvdata) return -ENOMEM;
platform_set_drvdata(plat_dev, new_drvdata);
new_drvdata->plat_dev = plat_dev;
new_drvdata->clk = of_clk_get(np, 0);
new_drvdata->coherent = of_dma_is_coherent(np);
/* Get device resources */
/* First CC registers space */
req_mem_cc_regs = platform_get_resource(plat_dev, IORESOURCE_MEM, 0);
/* Map registers space */
new_drvdata->cc_base = devm_ioremap_resource(dev, req_mem_cc_regs);
- if (IS_ERR(new_drvdata->cc_base)) {
- dev_err(dev, "Failed to ioremap registers");
- return PTR_ERR(new_drvdata->cc_base);
- }
+ if (IS_ERR(new_drvdata->cc_base)) return PTR_ERR(new_drvdata->cc_base);
dev_dbg(dev, "Got MEM resource (%s): %pR\n", req_mem_cc_regs->name, req_mem_cc_regs);
dev_dbg(dev, "CC registers mapped from %pa to 0x%p\n", &req_mem_cc_regs->start, new_drvdata->cc_base);
/* Then IRQ */
new_drvdata->irq = platform_get_irq(plat_dev, 0);
if (new_drvdata->irq < 0) {
dev_err(dev, "Failed getting IRQ resource\n");
return new_drvdata->irq;
}
rc = devm_request_irq(dev, new_drvdata->irq, cc_isr, IRQF_SHARED, "arm_cc7x", new_drvdata);
if (rc) {
dev_err(dev, "Could not register to interrupt %d\n", new_drvdata->irq);
return rc;
}
dev_dbg(dev, "Registered to IRQ: %d\n", new_drvdata->irq);
init_completion(&new_drvdata->hw_queue_avail);
if (!plat_dev->dev.dma_mask) plat_dev->dev.dma_mask = &plat_dev->dev.coherent_dma_mask;
dma_mask = DMA_BIT_MASK(DMA_BIT_MASK_LEN);
while (dma_mask > 0x7fffffffUL) {
if (dma_supported(&plat_dev->dev, dma_mask)) {
rc = dma_set_coherent_mask(&plat_dev->dev, dma_mask);
if (!rc) break;
}
dma_mask >>= 1;
}
if (rc) {
dev_err(dev, "Failed in dma_set_mask, mask=%par\n", &dma_mask);
return rc;
}
rc = cc_clk_on(new_drvdata);
if (rc) {
dev_err(dev, "Failed to enable clock");
return rc;
}
/* Verify correct mapping */
signature_val = cc_ioread(new_drvdata, CC_REG(HOST_SIGNATURE));
if (signature_val != CC_DEV_SIGNATURE) {
dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", signature_val, (u32)CC_DEV_SIGNATURE);
rc = -EINVAL;
goto post_clk_err;
}
dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val);
/* Display HW versions */
dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", CC_DEV_NAME_STR, cc_ioread(new_drvdata, CC_REG(HOST_VERSION)), DRV_MODULE_VERSION);
rc = init_cc_regs(new_drvdata, true);
if (rc) {
dev_err(dev, "init_cc_regs failed\n");
goto post_clk_err;
}
rc = cc_debugfs_init(new_drvdata);
if (rc) {
dev_err(dev, "Failed registering debugfs interface\n");
goto post_regs_err;
}
rc = cc_fips_init(new_drvdata);
if (rc) {
dev_err(dev, "CC_FIPS_INIT failed 0x%x\n", rc);
goto post_debugfs_err;
}
rc = cc_sram_mgr_init(new_drvdata);
if (rc) {
dev_err(dev, "cc_sram_mgr_init failed\n");
goto post_fips_init_err;
}
new_drvdata->mlli_sram_addr = cc_sram_alloc(new_drvdata, MAX_MLLI_BUFF_SIZE);
if (new_drvdata->mlli_sram_addr == NULL_SRAM_ADDR) {
dev_err(dev, "Failed to alloc MLLI Sram buffer\n");
rc = -ENOMEM;
goto post_sram_mgr_err;
}
rc = cc_req_mgr_init(new_drvdata);
if (rc) {
dev_err(dev, "cc_req_mgr_init failed\n");
goto post_sram_mgr_err;
}
rc = cc_buffer_mgr_init(new_drvdata);
if (rc) {
dev_err(dev, "buffer_mgr_init failed\n");
goto post_req_mgr_err;
}
rc = cc_pm_init(new_drvdata);
if (rc) {
dev_err(dev, "ssi_power_mgr_init failed\n");
goto post_buf_mgr_err;
}
rc = cc_ivgen_init(new_drvdata);
if (rc) {
dev_err(dev, "cc_ivgen_init failed\n");
goto post_power_mgr_err;
}
/* Allocate crypto algs */
rc = cc_cipher_alloc(new_drvdata);
if (rc) {
dev_err(dev, "cc_cipher_alloc failed\n");
goto post_ivgen_err;
}
/* hash must be allocated before aead since hash exports APIs */
rc = cc_hash_alloc(new_drvdata);
if (rc) {
dev_err(dev, "cc_hash_alloc failed\n");
goto post_cipher_err;
}
rc = cc_aead_alloc(new_drvdata);
if (rc) {
dev_err(dev, "cc_aead_alloc failed\n");
goto post_hash_err;
}
/* If we got here and FIPS mode is enabled
* it means all FIPS test passed, so let TEE
* know we're good.
*/
cc_set_ree_fips_status(new_drvdata, true);
return 0;
post_hash_err:
cc_hash_free(new_drvdata);
post_cipher_err:
cc_cipher_free(new_drvdata);
post_ivgen_err:
cc_ivgen_fini(new_drvdata);
post_power_mgr_err:
cc_pm_fini(new_drvdata);
post_buf_mgr_err:
cc_buffer_mgr_fini(new_drvdata);
post_req_mgr_err:
cc_req_mgr_fini(new_drvdata);
post_sram_mgr_err:
cc_sram_mgr_fini(new_drvdata);
post_fips_init_err:
cc_fips_fini(new_drvdata);
post_debugfs_err:
cc_debugfs_fini(new_drvdata);
post_regs_err:
fini_cc_regs(new_drvdata);
post_clk_err:
cc_clk_off(new_drvdata);
return rc;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = devm_ioremap_resource(...);
if (IS_ERR(x))
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 85 |
--- initial
+++ final
@@ -1,138 +1,137 @@
static int enable_slot(struct hotplug_slot *hs) {
int rc, i, rcpr;
struct slot *slot_cur;
u8 function;
struct pci_func *tmp_func;
ibmphp_lock_operations();
debug("ENABLING SLOT........\n");
slot_cur = hs->private;
rc = validate(slot_cur, ENABLE);
if (rc) {
err("validate function failed\n");
goto error_nopower;
}
attn_LED_blink(slot_cur);
rc = set_bus(slot_cur);
if (rc) {
err("was not able to set the bus\n");
goto error_nopower;
}
/*-----------------debugging------------------------------*/
get_cur_bus_info(&slot_cur);
debug("the current bus speed right after set_bus = %x\n", slot_cur->bus_on->current_speed);
/*----------------------------------------------------------*/
rc = check_limitations(slot_cur);
if (rc) {
err("Adding this card exceeds the limitations of this bus.\n");
err("(i.e., >1 133MHz cards running on same bus, or >2 66 PCI cards running on same bus.\n");
err("Try hot-adding into another bus\n");
rc = -EINVAL;
goto error_nopower;
}
rc = power_on(slot_cur);
if (rc) {
err("something wrong when powering up... please see below for details\n");
/* need to turn off before on, otherwise, blinking overwrites */
attn_off(slot_cur);
attn_on(slot_cur);
if (slot_update(&slot_cur)) {
attn_off(slot_cur);
attn_on(slot_cur);
rc = -ENODEV;
goto exit;
}
/* Check to see the error of why it failed */
if ((SLOT_POWER(slot_cur->status)) && !(SLOT_PWRGD(slot_cur->status)))
err("power fault occurred trying to power up\n");
else if (SLOT_BUS_SPEED(slot_cur->status)) {
err("bus speed mismatch occurred. please check current bus speed and card capability\n");
print_card_capability(slot_cur);
} else if (SLOT_BUS_MODE(slot_cur->ext_status)) {
err("bus mode mismatch occurred. please check current bus mode and card capability\n");
print_card_capability(slot_cur);
}
ibmphp_update_slot_info(slot_cur);
goto exit;
}
debug("after power_on\n");
/*-----------------------debugging---------------------------*/
get_cur_bus_info(&slot_cur);
debug("the current bus speed right after power_on = %x\n", slot_cur->bus_on->current_speed);
/*----------------------------------------------------------*/
rc = slot_update(&slot_cur);
if (rc) goto error_power;
rc = -EINVAL;
if (SLOT_POWER(slot_cur->status) && !(SLOT_PWRGD(slot_cur->status))) {
err("power fault occurred trying to power up...\n");
goto error_power;
}
if (SLOT_POWER(slot_cur->status) && (SLOT_BUS_SPEED(slot_cur->status))) {
err("bus speed mismatch occurred. please check current bus speed and card capability\n");
print_card_capability(slot_cur);
goto error_power;
}
/* Don't think this case will happen after above checks...
* but just in case, for paranoia sake */
if (!(SLOT_POWER(slot_cur->status))) {
err("power on failed...\n");
goto error_power;
}
slot_cur->func = kzalloc(sizeof(struct pci_func), GFP_KERNEL);
if (!slot_cur->func) {
/* We cannot do update_slot_info here, since no memory for
* kmalloc n.e.ways, and update_slot_info allocates some */
- err("out of system memory\n");
rc = -ENOMEM;
goto error_power;
}
slot_cur->func->busno = slot_cur->bus;
slot_cur->func->device = slot_cur->device;
for (i = 0; i < 4; i++)
slot_cur->func->irq[i] = slot_cur->irq[i];
debug("b4 configure_card, slot_cur->bus = %x, slot_cur->device = %x\n", slot_cur->bus, slot_cur->device);
if (ibmphp_configure_card(slot_cur->func, slot_cur->number)) {
err("configure_card was unsuccessful...\n");
/* true because don't need to actually deallocate resources,
* just remove references */
ibmphp_unconfigure_card(&slot_cur, 1);
debug("after unconfigure_card\n");
slot_cur->func = NULL;
rc = -ENOMEM;
goto error_power;
}
function = 0x00;
do {
tmp_func = ibm_slot_find(slot_cur->bus, slot_cur->func->device, function++);
if (tmp_func && !(tmp_func->dev)) ibm_configure_device(tmp_func);
} while (tmp_func);
attn_off(slot_cur);
if (slot_update(&slot_cur)) {
rc = -EFAULT;
goto exit;
}
ibmphp_print_test();
rc = ibmphp_update_slot_info(slot_cur);
exit:
ibmphp_unlock_operations();
return rc;
error_nopower:
attn_off(slot_cur); /* need to turn off if was blinking b4 */
attn_on(slot_cur);
error_cont:
rcpr = slot_update(&slot_cur);
if (rcpr) {
rc = rcpr;
goto exit;
}
ibmphp_update_slot_info(slot_cur);
goto exit;
error_power:
attn_off(slot_cur); /* need to turn off if was blinking b4 */
attn_on(slot_cur);
rcpr = power_off(slot_cur);
if (rcpr) {
rc = rcpr;
goto exit;
}
goto error_cont;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 61 |
--- initial
+++ final
@@ -1,44 +1,42 @@
static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res, struct bnxt_qplib_dpi_tbl *dpit, u32 dbr_offset) {
u32 dbr_bar_reg = RCFW_DBR_PCI_BAR_REGION;
resource_size_t bar_reg_base;
u32 dbr_len, bytes;
if (dpit->dbr_bar_reg_iomem) {
dev_err(&res->pdev->dev, "QPLIB: DBR BAR region %d already mapped", dbr_bar_reg);
return -EALREADY;
}
bar_reg_base = pci_resource_start(res->pdev, dbr_bar_reg);
if (!bar_reg_base) {
dev_err(&res->pdev->dev, "QPLIB: BAR region %d resc start failed", dbr_bar_reg);
return -ENOMEM;
}
dbr_len = pci_resource_len(res->pdev, dbr_bar_reg) - dbr_offset;
if (!dbr_len || ((dbr_len & (PAGE_SIZE - 1)) != 0)) {
dev_err(&res->pdev->dev, "QPLIB: Invalid DBR length %d", dbr_len);
return -ENOMEM;
}
dpit->dbr_bar_reg_iomem = ioremap_nocache(bar_reg_base + dbr_offset, dbr_len);
if (!dpit->dbr_bar_reg_iomem) {
dev_err(&res->pdev->dev, "QPLIB: FP: DBR BAR region %d mapping failed", dbr_bar_reg);
return -ENOMEM;
}
dpit->unmapped_dbr = bar_reg_base + dbr_offset;
dpit->max = dbr_len / PAGE_SIZE;
dpit->app_tbl = kcalloc(dpit->max, sizeof(void *), GFP_KERNEL);
if (!dpit->app_tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
- dev_err(&res->pdev->dev, "QPLIB: DPI app tbl allocation failed");
return -ENOMEM;
}
bytes = dpit->max >> 3;
if (!bytes) bytes = 1;
dpit->tbl = kmalloc(bytes, GFP_KERNEL);
if (!dpit->tbl) {
pci_iounmap(res->pdev, dpit->dbr_bar_reg_iomem);
kfree(dpit->app_tbl);
dpit->app_tbl = NULL;
- dev_err(&res->pdev->dev, "QPLIB: DPI tbl allocation failed for size = %d", bytes);
return -ENOMEM;
}
memset((u8 *)dpit->tbl, 0xFF, bytes);
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 91 |
--- initial
+++ final
@@ -1,34 +1,31 @@
static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {
int rc;
struct controller *ctrl;
if (!is_shpc_capable(pdev)) return -ENODEV;
ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
- if (!ctrl) {
- dev_err(&pdev->dev, "%s: Out of memory\n", __func__);
- goto err_out_none;
- }
+ if (!ctrl) goto err_out_none;
INIT_LIST_HEAD(&ctrl->slot_list);
rc = shpc_init(ctrl, pdev);
if (rc) {
ctrl_dbg(ctrl, "Controller initialization failed\n");
goto err_out_free_ctrl;
}
pci_set_drvdata(pdev, ctrl);
/* Setup the slot information structures */
rc = init_slots(ctrl);
if (rc) {
ctrl_err(ctrl, "Slot initialization failed\n");
goto err_out_release_ctlr;
}
rc = shpchp_create_ctrl_files(ctrl);
if (rc) goto err_cleanup_slots;
return 0;
err_cleanup_slots:
cleanup_slots(ctrl);
err_out_release_ctlr:
ctrl->hpc_ops->release_ctlr(ctrl);
err_out_free_ctrl:
kfree(ctrl);
err_out_none:
return -ENODEV;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 78 |
--- initial
+++ final
@@ -1,40 +1,37 @@
static int __init once_over(void) {
struct resource_node *pfmem_cur;
struct resource_node *pfmem_prev;
struct resource_node *mem;
struct bus_node *bus_cur;
list_for_each_entry(bus_cur, &gbuses, bus_list) {
if ((!bus_cur->rangePFMem) && (bus_cur->firstPFMem)) {
for (pfmem_cur = bus_cur->firstPFMem, pfmem_prev = NULL; pfmem_cur; pfmem_prev = pfmem_cur, pfmem_cur = pfmem_cur->next) {
pfmem_cur->fromMem = 1;
if (pfmem_prev)
pfmem_prev->next = pfmem_cur->next;
else
bus_cur->firstPFMem = pfmem_cur->next;
if (!bus_cur->firstPFMemFromMem)
pfmem_cur->next = NULL;
else
/* we don't need to sort PFMemFromMem since we're using mem node for
all the real work anyways, so just insert at the beginning of the
list
*/
pfmem_cur->next = bus_cur->firstPFMemFromMem;
bus_cur->firstPFMemFromMem = pfmem_cur;
mem = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
- if (!mem) {
- err("out of system memory\n");
- return -ENOMEM;
- }
+ if (!mem) return -ENOMEM;
mem->type = MEM;
mem->busno = pfmem_cur->busno;
mem->devfunc = pfmem_cur->devfunc;
mem->start = pfmem_cur->start;
mem->end = pfmem_cur->end;
mem->len = pfmem_cur->len;
if (ibmphp_add_resource(mem) < 0) err("Trouble...trouble... EBDA allocated pfmem from mem, but system doesn't display it has this space... unless not PCI device...\n");
pfmem_cur->rangeno = mem->rangeno;
} /* end for pfmem */
} /* end if */
} /* end list_for_each bus */
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 72 |
--- initial
+++ final
@@ -1,15 +1,12 @@
static int wm8750_pinctrl_probe(struct platform_device *pdev) {
struct wmt_pinctrl_data *data;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- if (!data) {
- dev_err(&pdev->dev, "failed to allocate data\n");
- return -ENOMEM;
- }
+ if (!data) return -ENOMEM;
data->banks = wm8750_banks;
data->nbanks = ARRAY_SIZE(wm8750_banks);
data->pins = wm8750_pins;
data->npins = ARRAY_SIZE(wm8750_pins);
data->groups = wm8750_groups;
data->ngroups = ARRAY_SIZE(wm8750_groups);
return wmt_pinctrl_probe(pdev, data);
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 56 |
--- initial
+++ final
@@ -1,82 +1,81 @@
static int wm2000_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *i2c_id) {
struct wm2000_priv *wm2000;
struct wm2000_platform_data *pdata;
const char *filename;
const struct firmware *fw = NULL;
int ret, i;
int reg;
u16 id;
wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv), GFP_KERNEL);
if (!wm2000) return -ENOMEM;
mutex_init(&wm2000->lock);
dev_set_drvdata(&i2c->dev, wm2000);
wm2000->regmap = devm_regmap_init_i2c(i2c, &wm2000_regmap);
if (IS_ERR(wm2000->regmap)) {
ret = PTR_ERR(wm2000->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret);
goto out;
}
for (i = 0; i < WM2000_NUM_SUPPLIES; i++)
wm2000->supplies[i].supply = wm2000_supplies[i];
ret = devm_regulator_bulk_get(&i2c->dev, WM2000_NUM_SUPPLIES, wm2000->supplies);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to get supplies: %d\n", ret);
return ret;
}
ret = regulator_bulk_enable(WM2000_NUM_SUPPLIES, wm2000->supplies);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
return ret;
}
/* Verify that this is a WM2000 */
reg = wm2000_read(i2c, WM2000_REG_ID1);
id = reg << 8;
reg = wm2000_read(i2c, WM2000_REG_ID2);
id |= reg & 0xff;
if (id != 0x2000) {
dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
ret = -ENODEV;
goto err_supplies;
}
reg = wm2000_read(i2c, WM2000_REG_REVISON);
dev_info(&i2c->dev, "revision %c\n", reg + 'A');
wm2000->mclk = devm_clk_get(&i2c->dev, "MCLK");
if (IS_ERR(wm2000->mclk)) {
ret = PTR_ERR(wm2000->mclk);
dev_err(&i2c->dev, "Failed to get MCLK: %d\n", ret);
goto err_supplies;
}
filename = "wm2000_anc.bin";
pdata = dev_get_platdata(&i2c->dev);
if (pdata) {
wm2000->speech_clarity = !pdata->speech_enh_disable;
if (pdata->download_file) filename = pdata->download_file;
}
ret = request_firmware(&fw, filename, &i2c->dev);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
goto err_supplies;
}
/* Pre-cook the concatenation of the register address onto the image */
wm2000->anc_download_size = fw->size + 2;
wm2000->anc_download = devm_kzalloc(&i2c->dev, wm2000->anc_download_size, GFP_KERNEL);
if (wm2000->anc_download == NULL) {
- dev_err(&i2c->dev, "Out of memory\n");
ret = -ENOMEM;
goto err_supplies;
}
wm2000->anc_download[0] = 0x80;
wm2000->anc_download[1] = 0x00;
memcpy(wm2000->anc_download + 2, fw->data, fw->size);
wm2000->anc_eng_ena = 1;
wm2000->anc_active = 1;
wm2000->spk_ena = 1;
wm2000->i2c = i2c;
wm2000_reset(wm2000);
ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0);
err_supplies:
regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies);
out:
release_firmware(fw);
return ret;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 25 |
--- initial
+++ final
@@ -1,45 +1,42 @@
int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) {
struct drm_exynos_file_private *file_priv = file->driver_priv;
struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv;
struct device *dev;
struct g2d_data *g2d;
struct drm_exynos_g2d_exec *req = data;
struct g2d_runqueue_node *runqueue_node;
struct list_head *run_cmdlist;
struct list_head *event_list;
if (!g2d_priv) return -ENODEV;
dev = g2d_priv->dev;
if (!dev) return -ENODEV;
g2d = dev_get_drvdata(dev);
if (!g2d) return -EFAULT;
runqueue_node = kmem_cache_alloc(g2d->runqueue_slab, GFP_KERNEL);
- if (!runqueue_node) {
- dev_err(dev, "failed to allocate memory\n");
- return -ENOMEM;
- }
+ if (!runqueue_node) return -ENOMEM;
run_cmdlist = &runqueue_node->run_cmdlist;
event_list = &runqueue_node->event_list;
INIT_LIST_HEAD(run_cmdlist);
INIT_LIST_HEAD(event_list);
init_completion(&runqueue_node->complete);
runqueue_node->async = req->async;
list_splice_init(&g2d_priv->inuse_cmdlist, run_cmdlist);
list_splice_init(&g2d_priv->event_list, event_list);
if (list_empty(run_cmdlist)) {
dev_err(dev, "there is no inuse cmdlist\n");
kmem_cache_free(g2d->runqueue_slab, runqueue_node);
return -EPERM;
}
mutex_lock(&g2d->runqueue_mutex);
runqueue_node->pid = current->pid;
runqueue_node->filp = file;
list_add_tail(&runqueue_node->list, &g2d->runqueue);
mutex_unlock(&g2d->runqueue_mutex);
/* Let the runqueue know that there is work to do. */
queue_work(g2d->g2d_workq, &g2d->runqueue_work);
if (runqueue_node->async) goto out;
wait_for_completion(&runqueue_node->complete);
g2d_free_runqueue_node(g2d, runqueue_node);
out:
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 94 |
--- initial
+++ final
@@ -1,78 +1,75 @@
static int cs42l56_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
struct cs42l56_private *cs42l56;
struct cs42l56_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
int ret, i;
unsigned int devid = 0;
unsigned int alpha_rev, metal_rev;
unsigned int reg;
cs42l56 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l56_private), GFP_KERNEL);
if (cs42l56 == NULL) return -ENOMEM;
cs42l56->dev = &i2c_client->dev;
cs42l56->regmap = devm_regmap_init_i2c(i2c_client, &cs42l56_regmap);
if (IS_ERR(cs42l56->regmap)) {
ret = PTR_ERR(cs42l56->regmap);
dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
return ret;
}
if (pdata) {
cs42l56->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l56_platform_data), GFP_KERNEL);
- if (!pdata) {
- dev_err(&i2c_client->dev, "could not allocate pdata\n");
- return -ENOMEM;
- }
+ if (!pdata) return -ENOMEM;
if (i2c_client->dev.of_node) {
ret = cs42l56_handle_of_data(i2c_client, &cs42l56->pdata);
if (ret != 0) return ret;
}
cs42l56->pdata = *pdata;
}
if (cs42l56->pdata.gpio_nreset) {
ret = gpio_request_one(cs42l56->pdata.gpio_nreset, GPIOF_OUT_INIT_HIGH, "CS42L56 /RST");
if (ret < 0) {
dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l56->pdata.gpio_nreset, ret);
return ret;
}
gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 0);
gpio_set_value_cansleep(cs42l56->pdata.gpio_nreset, 1);
}
i2c_set_clientdata(i2c_client, cs42l56);
for (i = 0; i < ARRAY_SIZE(cs42l56->supplies); i++)
cs42l56->supplies[i].supply = cs42l56_supply_names[i];
ret = devm_regulator_bulk_get(&i2c_client->dev, ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
if (ret != 0) {
dev_err(&i2c_client->dev, "Failed to request supplies: %d\n", ret);
return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
if (ret != 0) {
dev_err(&i2c_client->dev, "Failed to enable supplies: %d\n", ret);
return ret;
}
ret = regmap_read(cs42l56->regmap, CS42L56_CHIP_ID_1, ®);
devid = reg & CS42L56_CHIP_ID_MASK;
if (devid != CS42L56_DEVID) {
dev_err(&i2c_client->dev, "CS42L56 Device ID (%X). Expected %X\n", devid, CS42L56_DEVID);
goto err_enable;
}
alpha_rev = reg & CS42L56_AREV_MASK;
metal_rev = reg & CS42L56_MTLREV_MASK;
dev_info(&i2c_client->dev, "Cirrus Logic CS42L56 ");
dev_info(&i2c_client->dev, "Alpha Rev %X Metal Rev %X\n", alpha_rev, metal_rev);
if (cs42l56->pdata.ain1a_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN1A_REF_MASK, CS42L56_AIN1A_REF_MASK);
if (cs42l56->pdata.ain1b_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN1B_REF_MASK, CS42L56_AIN1B_REF_MASK);
if (cs42l56->pdata.ain2a_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN2A_REF_MASK, CS42L56_AIN2A_REF_MASK);
if (cs42l56->pdata.ain2b_ref_cfg) regmap_update_bits(cs42l56->regmap, CS42L56_AIN_REFCFG_ADC_MUX, CS42L56_AIN2B_REF_MASK, CS42L56_AIN2B_REF_MASK);
if (cs42l56->pdata.micbias_lvl) regmap_update_bits(cs42l56->regmap, CS42L56_GAIN_BIAS_CTL, CS42L56_MIC_BIAS_MASK, cs42l56->pdata.micbias_lvl);
if (cs42l56->pdata.chgfreq) regmap_update_bits(cs42l56->regmap, CS42L56_CLASSH_CTL, CS42L56_CHRG_FREQ_MASK, cs42l56->pdata.chgfreq);
if (cs42l56->pdata.hpfb_freq) regmap_update_bits(cs42l56->regmap, CS42L56_HPF_CTL, CS42L56_HPFB_FREQ_MASK, cs42l56->pdata.hpfb_freq);
if (cs42l56->pdata.hpfa_freq) regmap_update_bits(cs42l56->regmap, CS42L56_HPF_CTL, CS42L56_HPFA_FREQ_MASK, cs42l56->pdata.hpfa_freq);
if (cs42l56->pdata.adaptive_pwr) regmap_update_bits(cs42l56->regmap, CS42L56_CLASSH_CTL, CS42L56_ADAPT_PWR_MASK, cs42l56->pdata.adaptive_pwr);
ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l56, &cs42l56_dai, 1);
if (ret < 0) return ret;
return 0;
err_enable:
regulator_bulk_disable(ARRAY_SIZE(cs42l56->supplies), cs42l56->supplies);
return ret;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 21 |
--- initial
+++ final
@@ -1,45 +1,44 @@
static int __init ibmphp_init(void) {
struct pci_bus *bus;
int i = 0;
int rc = 0;
init_flag = 1;
info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
ibmphp_pci_bus = kmalloc(sizeof(*ibmphp_pci_bus), GFP_KERNEL);
if (!ibmphp_pci_bus) {
- err("out of memory\n");
rc = -ENOMEM;
goto exit;
}
bus = pci_find_bus(0, 0);
if (!bus) {
err("Can't find the root pci bus, can not continue\n");
rc = -ENODEV;
goto error;
}
memcpy(ibmphp_pci_bus, bus, sizeof(*ibmphp_pci_bus));
ibmphp_debug = debug;
ibmphp_hpc_initvars();
for (i = 0; i < 16; i++)
irqs[i] = 0;
rc = ibmphp_access_ebda();
if (rc) goto error;
debug("after ibmphp_access_ebda()\n");
rc = ibmphp_rsrc_init();
if (rc) goto error;
debug("AFTER Resource & EBDA INITIALIZATIONS\n");
max_slots = get_max_slots();
rc = ibmphp_register_pci();
if (rc) goto error;
if (init_ops()) {
rc = -ENODEV;
goto error;
}
ibmphp_print_test();
rc = ibmphp_hpc_start_poll_thread();
if (rc) goto error;
exit:
return rc;
error:
ibmphp_unload();
goto exit;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL) {
...
- f(...,c,...);
...
} else S
<|end_of_text|> | 63 |
--- initial
+++ final
@@ -1,71 +1,65 @@
static int plgpio_probe(struct platform_device *pdev) {
struct plgpio *plgpio;
struct resource *res;
int ret, irq;
plgpio = devm_kzalloc(&pdev->dev, sizeof(*plgpio), GFP_KERNEL);
- if (!plgpio) {
- dev_err(&pdev->dev, "memory allocation fail\n");
- return -ENOMEM;
- }
+ if (!plgpio) return -ENOMEM;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
plgpio->base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(plgpio->base)) return PTR_ERR(plgpio->base);
ret = plgpio_probe_dt(pdev, plgpio);
if (ret) {
dev_err(&pdev->dev, "DT probe failed\n");
return ret;
}
plgpio->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(plgpio->clk)) dev_warn(&pdev->dev, "clk_get() failed, work without it\n");
#ifdef CONFIG_PM_SLEEP
plgpio->csave_regs = devm_kzalloc(&pdev->dev, sizeof(*plgpio->csave_regs) * DIV_ROUND_UP(plgpio->chip.ngpio, MAX_GPIO_PER_REG), GFP_KERNEL);
- if (!plgpio->csave_regs) {
- dev_err(&pdev->dev, "csave registers memory allocation fail\n");
- return -ENOMEM;
- }
+ if (!plgpio->csave_regs) return -ENOMEM;
#endif
platform_set_drvdata(pdev, plgpio);
spin_lock_init(&plgpio->lock);
plgpio->chip.base = -1;
plgpio->chip.request = plgpio_request;
plgpio->chip.free = plgpio_free;
plgpio->chip.direction_input = plgpio_direction_input;
plgpio->chip.direction_output = plgpio_direction_output;
plgpio->chip.get = plgpio_get_value;
plgpio->chip.set = plgpio_set_value;
plgpio->chip.label = dev_name(&pdev->dev);
plgpio->chip.parent = &pdev->dev;
plgpio->chip.owner = THIS_MODULE;
plgpio->chip.of_node = pdev->dev.of_node;
if (!IS_ERR(plgpio->clk)) {
ret = clk_prepare(plgpio->clk);
if (ret) {
dev_err(&pdev->dev, "clk prepare failed\n");
return ret;
}
}
ret = gpiochip_add_data(&plgpio->chip, plgpio);
if (ret) {
dev_err(&pdev->dev, "unable to add gpio chip\n");
goto unprepare_clk;
}
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_info(&pdev->dev, "PLGPIO registered without IRQs\n");
return 0;
}
ret = gpiochip_irqchip_add(&plgpio->chip, &plgpio_irqchip, 0, handle_simple_irq, IRQ_TYPE_NONE);
if (ret) {
dev_err(&pdev->dev, "failed to add irqchip to gpiochip\n");
goto remove_gpiochip;
}
gpiochip_set_chained_irqchip(&plgpio->chip, &plgpio_irqchip, irq, plgpio_irq_handler);
dev_info(&pdev->dev, "PLGPIO registered with IRQs\n");
return 0;
remove_gpiochip:
dev_info(&pdev->dev, "Remove gpiochip\n");
gpiochip_remove(&plgpio->chip);
unprepare_clk:
if (!IS_ERR(plgpio->clk)) clk_unprepare(plgpio->clk);
return ret;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 50 |
--- initial
+++ final
@@ -1,35 +1,32 @@
static int i40e_init_interrupt_scheme(struct i40e_pf *pf) {
int vectors = 0;
ssize_t size;
if (pf->flags & I40E_FLAG_MSIX_ENABLED) {
vectors = i40e_init_msix(pf);
if (vectors < 0) {
pf->flags &= ~(I40E_FLAG_MSIX_ENABLED | I40E_FLAG_IWARP_ENABLED | I40E_FLAG_RSS_ENABLED | I40E_FLAG_DCB_CAPABLE | I40E_FLAG_DCB_ENABLED | I40E_FLAG_SRIOV_ENABLED | I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED | I40E_FLAG_VMDQ_ENABLED);
pf->flags |= I40E_FLAG_FD_SB_INACTIVE;
/* rework the queue expectations without MSIX */
i40e_determine_queue_usage(pf);
}
}
if (!(pf->flags & I40E_FLAG_MSIX_ENABLED) && (pf->flags & I40E_FLAG_MSI_ENABLED)) {
dev_info(&pf->pdev->dev, "MSI-X not available, trying MSI\n");
vectors = pci_enable_msi(pf->pdev);
if (vectors < 0) {
dev_info(&pf->pdev->dev, "MSI init failed - %d\n", vectors);
pf->flags &= ~I40E_FLAG_MSI_ENABLED;
}
vectors = 1; /* one MSI or Legacy vector */
}
if (!(pf->flags & (I40E_FLAG_MSIX_ENABLED | I40E_FLAG_MSI_ENABLED))) dev_info(&pf->pdev->dev, "MSI-X and MSI not available, falling back to Legacy IRQ\n");
/* set up vector assignment tracking */
size = sizeof(struct i40e_lump_tracking) + (sizeof(u16) * vectors);
pf->irq_pile = kzalloc(size, GFP_KERNEL);
- if (!pf->irq_pile) {
- dev_err(&pf->pdev->dev, "error allocating irq_pile memory\n");
- return -ENOMEM;
- }
+ if (!pf->irq_pile) return -ENOMEM;
pf->irq_pile->num_entries = vectors;
pf->irq_pile->search_hint = 0;
/* track first vector for misc interrupts, ignore return */
(void)i40e_get_lump(pf, pf->irq_pile, 1, I40E_PILE_VALID_BIT - 1);
return 0;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 82 |
--- initial
+++ final
@@ -1,65 +1,62 @@
void acpiphp_enumerate_slots(struct pci_bus *bus) {
struct acpiphp_bridge *bridge;
struct acpi_device *adev;
acpi_handle handle;
acpi_status status;
if (acpiphp_disabled) return;
adev = ACPI_COMPANION(bus->bridge);
if (!adev) return;
handle = adev->handle;
bridge = kzalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
- if (!bridge) {
- acpi_handle_err(handle, "No memory for bridge object\n");
- return;
- }
+ if (!bridge) return;
INIT_LIST_HEAD(&bridge->slots);
kref_init(&bridge->ref);
bridge->pci_dev = pci_dev_get(bus->self);
bridge->pci_bus = bus;
/*
* Grab a ref to the subordinate PCI bus in case the bus is
* removed via PCI core logical hotplug. The ref pins the bus
* (which we access during module unload).
*/
get_device(&bus->dev);
acpi_lock_hp_context();
if (pci_is_root_bus(bridge->pci_bus)) {
struct acpiphp_root_context *root_context;
root_context = kzalloc(sizeof(*root_context), GFP_KERNEL);
if (!root_context) goto err;
root_context->root_bridge = bridge;
acpi_set_hp_context(adev, &root_context->hp);
} else {
struct acpiphp_context *context;
/*
* This bridge should have been registered as a hotplug function
* under its parent, so the context should be there, unless the
* parent is going to be handled by pciehp, in which case this
* bridge is not interesting to us either.
*/
context = acpiphp_get_context(adev);
if (!context) goto err;
bridge->context = context;
context->bridge = bridge;
/* Get a reference to the parent bridge. */
get_bridge(context->func.parent);
}
acpi_unlock_hp_context();
/* Must be added to the list prior to calling acpiphp_add_context(). */
mutex_lock(&bridge_mutex);
list_add(&bridge->list, &bridge_list);
mutex_unlock(&bridge_mutex);
/* register all slot objects under this bridge */
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, acpiphp_add_context, NULL, bridge, NULL);
if (ACPI_FAILURE(status)) {
acpi_handle_err(handle, "failed to register slots\n");
cleanup_bridge(bridge);
put_bridge(bridge);
}
return;
err:
acpi_unlock_hp_context();
put_device(&bus->dev);
pci_dev_put(bridge->pci_dev);
kfree(bridge);
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 58 |
--- initial
+++ final
@@ -1,18 +1,15 @@
static struct resource_node *__init alloc_resources(struct ebda_pci_rsrc *curr) {
struct resource_node *rs;
if (!curr) {
err("NULL passed to allocate\n");
return NULL;
}
rs = kzalloc(sizeof(struct resource_node), GFP_KERNEL);
- if (!rs) {
- err("out of system memory\n");
- return NULL;
- }
+ if (!rs) return NULL;
rs->busno = curr->bus_num;
rs->devfunc = curr->dev_fun;
rs->start = curr->start_addr;
rs->end = curr->end_addr;
rs->len = curr->end_addr - curr->start_addr + 1;
return rs;
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 71 |
--- initial
+++ final
@@ -1,60 +1,57 @@
static struct se_wwn *tcm_loop_make_scsi_hba(struct target_fabric_configfs *tf, struct config_group *group, const char *name) {
struct tcm_loop_hba *tl_hba;
struct Scsi_Host *sh;
char *ptr;
int ret, off = 0;
tl_hba = kzalloc(sizeof(struct tcm_loop_hba), GFP_KERNEL);
- if (!tl_hba) {
- pr_err("Unable to allocate struct tcm_loop_hba\n");
- return ERR_PTR(-ENOMEM);
- }
+ if (!tl_hba) return ERR_PTR(-ENOMEM);
/*
* Determine the emulated Protocol Identifier and Target Port Name
* based on the incoming configfs directory name.
*/
ptr = strstr(name, "naa.");
if (ptr) {
tl_hba->tl_proto_id = SCSI_PROTOCOL_SAS;
goto check_len;
}
ptr = strstr(name, "fc.");
if (ptr) {
tl_hba->tl_proto_id = SCSI_PROTOCOL_FCP;
off = 3; /* Skip over "fc." */
goto check_len;
}
ptr = strstr(name, "iqn.");
if (!ptr) {
pr_err("Unable to locate prefix for emulated Target "
"Port: %s\n",
name);
ret = -EINVAL;
goto out;
}
tl_hba->tl_proto_id = SCSI_PROTOCOL_ISCSI;
check_len:
if (strlen(name) >= TL_WWN_ADDR_LEN) {
pr_err("Emulated NAA %s Address: %s, exceeds"
" max: %d\n",
name, tcm_loop_dump_proto_id(tl_hba), TL_WWN_ADDR_LEN);
ret = -EINVAL;
goto out;
}
snprintf(&tl_hba->tl_wwn_address[0], TL_WWN_ADDR_LEN, "%s", &name[off]);
/*
* Call device_register(tl_hba->dev) to register the emulated
* Linux/SCSI LLD of type struct Scsi_Host at tl_hba->sh after
* device_register() callbacks in tcm_loop_driver_probe()
*/
ret = tcm_loop_setup_hba_bus(tl_hba, tcm_loop_hba_no_cnt);
if (ret) goto out;
sh = tl_hba->sh;
tcm_loop_hba_no_cnt++;
pr_debug("TCM_Loop_ConfigFS: Allocated emulated Target"
" %s Address: %s at Linux/SCSI Host ID: %d\n",
tcm_loop_dump_proto_id(tl_hba), name, sh->host_no);
return &tl_hba->tl_hba_wwn;
out:
kfree(tl_hba);
return ERR_PTR(ret);
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 32 |
--- initial
+++ final
@@ -1,15 +1,12 @@
static int wm8650_pinctrl_probe(struct platform_device *pdev) {
struct wmt_pinctrl_data *data;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- if (!data) {
- dev_err(&pdev->dev, "failed to allocate data\n");
- return -ENOMEM;
- }
+ if (!data) return -ENOMEM;
data->banks = wm8650_banks;
data->nbanks = ARRAY_SIZE(wm8650_banks);
data->pins = wm8650_pins;
data->npins = ARRAY_SIZE(wm8650_pins);
data->groups = wm8650_groups;
data->ngroups = ARRAY_SIZE(wm8650_groups);
return wmt_pinctrl_probe(pdev, data);
}<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@
x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
\|rhashtable_lookup_fast\)
(...);
if (x == NULL)
- {
- f(...,c,...);
S1
- }
else S2
<|end_of_text|> | 55 |
--- initial
+++ final
@@ -1,6 +1,6 @@
static int exynos_suspend(void) {
if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) exynos_save_cp15();
writel(EXYNOS_SLEEP_MAGIC, sysram_ns_base_addr + EXYNOS_BOOT_FLAG);
- writel(virt_to_phys(exynos_cpu_resume_ns), sysram_ns_base_addr + EXYNOS_BOOT_ADDR);
+ writel(__pa_symbol(exynos_cpu_resume_ns), sysram_ns_base_addr + EXYNOS_BOOT_ADDR);
return cpu_suspend(0, exynos_cpu_suspend);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,115 |
--- initial
+++ final
@@ -1 +1 @@
-void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr) { writel(virt_to_phys(boot_addr), pmsu_mp_base + PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); }
+void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr) { writel(__pa_symbol(boot_addr), pmsu_mp_base + PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); }<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,174 |
--- initial
+++ final
@@ -1,63 +1,63 @@
static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) {
unsigned long timeout;
u32 mpidr = cpu_logical_map(cpu);
u32 core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
int ret = -ENOSYS;
/*
* Set synchronisation state between this boot processor
* and the secondary one
*/
spin_lock(&boot_lock);
/*
* The secondary processor is waiting to be released from
* the holding pen - release it, then wait for it to flag
* that it has been released by resetting pen_release.
*
* Note that "pen_release" is the hardware CPU core ID, whereas
* "cpu" is Linux's internal ID.
*/
write_pen_release(core_id);
if (!exynos_cpu_power_state(core_id)) {
exynos_cpu_power_up(core_id);
timeout = 10;
/* wait max 10 ms until cpu1 is on */
while (exynos_cpu_power_state(core_id) != S5P_CORE_LOCAL_PWR_EN) {
if (timeout-- == 0) break;
mdelay(1);
}
if (timeout == 0) {
printk(KERN_ERR "cpu1 power enable failed");
spin_unlock(&boot_lock);
return -ETIMEDOUT;
}
}
exynos_core_restart(core_id);
/*
* Send the secondary CPU a soft interrupt, thereby causing
* the boot monitor to read the system wide flags register,
* and branch to the address found there.
*/
timeout = jiffies + (1 * HZ);
while (time_before(jiffies, timeout)) {
unsigned long boot_addr;
smp_rmb();
- boot_addr = virt_to_phys(exynos4_secondary_startup);
+ boot_addr = __pa_symbol(exynos4_secondary_startup);
ret = exynos_set_boot_addr(core_id, boot_addr);
if (ret) goto fail;
call_firmware_op(cpu_boot, core_id);
if (soc_is_exynos3250())
dsb_sev();
else
arch_send_wakeup_ipi_mask(cpumask_of(cpu));
if (pen_release == -1) break;
udelay(10);
}
if (pen_release != -1) ret = -ETIMEDOUT;
/*
* now the secondary core is starting up let it run its
* calibrations, then wait for it to finish
*/
fail:
spin_unlock(&boot_lock);
return pen_release != -1 ? ret : 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,121 |
--- initial
+++ final
@@ -1,35 +1,35 @@
static int bcm63138_smp_boot_secondary(unsigned int cpu, struct task_struct *idle) {
void __iomem *bootlut_base;
struct device_node *dn;
int ret = 0;
u32 val;
dn = of_find_matching_node(NULL, bcm63138_bootlut_ids);
if (!dn) {
pr_err("SMP: unable to find bcm63138 boot LUT node\n");
return -ENODEV;
}
bootlut_base = of_iomap(dn, 0);
of_node_put(dn);
if (!bootlut_base) {
pr_err("SMP: unable to remap boot LUT base register\n");
return -ENOMEM;
}
/* Locate the secondary CPU node */
dn = of_get_cpu_node(cpu, NULL);
if (!dn) {
pr_err("SMP: failed to locate secondary CPU%d node\n", cpu);
ret = -ENODEV;
goto out;
}
/* Write the secondary init routine to the BootLUT reset vector */
- val = virt_to_phys(secondary_startup);
+ val = __pa_symbol(secondary_startup);
writel_relaxed(val, bootlut_base + BOOTLUT_RESET_VECT);
/* Power up the core, will jump straight to its reset vector when we
* return
*/
ret = bcm63xx_pmb_power_on_cpu(dn);
if (ret) goto out;
out:
iounmap(bootlut_base);
return ret;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,111 |
--- initial
+++ final
@@ -1,20 +1,20 @@
static int sun8i_smp_boot_secondary(unsigned int cpu, struct task_struct *idle) {
u32 reg;
if (!(prcm_membase && cpucfg_membase)) return -EFAULT;
spin_lock(&cpu_lock);
/* Set CPU boot address */
- writel(virt_to_phys(secondary_startup), cpucfg_membase + CPUCFG_PRIVATE0_REG);
+ writel(__pa_symbol(secondary_startup), cpucfg_membase + CPUCFG_PRIVATE0_REG);
/* Assert the CPU core in reset */
writel(0, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
/* Assert the L1 cache in reset */
reg = readl(cpucfg_membase + CPUCFG_GEN_CTRL_REG);
writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_GEN_CTRL_REG);
/* Clear CPU power-off gating */
reg = readl(prcm_membase + PRCM_CPU_PWROFF_REG);
writel(reg & ~BIT(cpu), prcm_membase + PRCM_CPU_PWROFF_REG);
mdelay(1);
/* Deassert the CPU core reset */
writel(3, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
spin_unlock(&cpu_lock);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,146 |
--- initial
+++ final
@@ -1,9 +1,9 @@
static void s3c2416_pm_prepare(void) {
/*
* write the magic value u-boot uses to check for resume into
* the INFORM0 register, and ensure INFORM1 is set to the
* correct address to resume from.
*/
__raw_writel(0x2BED, S3C2412_INFORM0);
- __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
+ __raw_writel(__pa_symbol(s3c_cpu_resume), S3C2412_INFORM1);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,172 |
--- initial
+++ final
@@ -1,21 +1,21 @@
static void s5pv210_pm_prepare(void) {
unsigned int tmp;
/* Set wake-up mask registers */
__raw_writel(exynos_get_eint_wake_mask(), S5P_EINT_WAKEUP_MASK);
__raw_writel(s5pv210_irqwake_intmask, S5P_WAKEUP_MASK);
/* ensure at least INFORM0 has the resume address */
- __raw_writel(virt_to_phys(s5pv210_cpu_resume), S5P_INFORM0);
+ __raw_writel(__pa_symbol(s5pv210_cpu_resume), S5P_INFORM0);
tmp = __raw_readl(S5P_SLEEP_CFG);
tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN);
__raw_writel(tmp, S5P_SLEEP_CFG);
/* WFI for SLEEP mode configuration by SYSCON */
tmp = __raw_readl(S5P_PWR_CFG);
tmp &= S5P_CFG_WFI_CLEAN;
tmp |= S5P_CFG_WFI_SLEEP;
__raw_writel(tmp, S5P_PWR_CFG);
/* SYSCON interrupt handling disable */
tmp = __raw_readl(S5P_OTHERS);
tmp |= S5P_OTHER_SYSC_INTOFF;
__raw_writel(tmp, S5P_OTHERS);
s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,139 |
--- initial
+++ final
@@ -1,70 +1,70 @@
static int exynos_cpu0_enter_aftr(void) {
int ret = -1;
/*
* If the other cpu is powered on, we have to power it off, because
* the AFTR state won't work otherwise
*/
if (cpu_online(1)) {
/*
* We reach a sync point with the coupled idle state, we know
* the other cpu will power down itself or will abort the
* sequence, let's wait for one of these to happen
*/
while (exynos_cpu_power_state(1)) {
unsigned long boot_addr;
/*
* The other cpu may skip idle and boot back
* up again
*/
if (atomic_read(&cpu1_wakeup)) goto abort;
/*
* The other cpu may bounce through idle and
* boot back up again, getting stuck in the
* boot rom code
*/
ret = exynos_get_boot_addr(1, &boot_addr);
if (ret) goto fail;
ret = -1;
if (boot_addr == 0) goto abort;
cpu_relax();
}
}
exynos_enter_aftr();
ret = 0;
abort:
if (cpu_online(1)) {
- unsigned long boot_addr = virt_to_phys(exynos_cpu_resume);
+ unsigned long boot_addr = __pa_symbol(exynos_cpu_resume);
/*
* Set the boot vector to something non-zero
*/
ret = exynos_set_boot_addr(1, boot_addr);
if (ret) goto fail;
dsb();
/*
* Turn on cpu1 and wait for it to be on
*/
exynos_cpu_power_up(1);
while (exynos_cpu_power_state(1) != S5P_CORE_LOCAL_PWR_EN)
cpu_relax();
if (soc_is_exynos3250()) {
while (!pmu_raw_readl(S5P_PMU_SPARE2) && !atomic_read(&cpu1_wakeup))
cpu_relax();
if (!atomic_read(&cpu1_wakeup)) exynos_core_restart(1);
}
while (!atomic_read(&cpu1_wakeup)) {
smp_rmb();
/*
* Poke cpu1 out of the boot rom
*/
ret = exynos_set_boot_addr(1, boot_addr);
if (ret) goto fail;
call_firmware_op(cpu_boot, 1);
if (soc_is_exynos3250())
dsb_sev();
else
arch_send_wakeup_ipi_mask(cpumask_of(1));
}
}
fail:
return ret;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,123 |
--- initial
+++ final
@@ -1,11 +1,11 @@
static void exynos3250_pm_prepare(void) {
unsigned int tmp;
/* Set wake-up mask registers */
exynos_pm_set_wakeup_mask();
tmp = pmu_raw_readl(EXYNOS3_ARM_L2_OPTION);
tmp &= ~EXYNOS5_OPTION_USE_RETENTION;
pmu_raw_writel(tmp, EXYNOS3_ARM_L2_OPTION);
exynos_pm_enter_sleep_mode();
/* ensure at least INFORM0 has the resume address */
- pmu_raw_writel(virt_to_phys(exynos_cpu_resume), S5P_INFORM0);
+ pmu_raw_writel(__pa_symbol(exynos_cpu_resume), S5P_INFORM0);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,180 |
--- initial
+++ final
@@ -1,5 +1,5 @@
static int pxa25x_cpu_pm_prepare(void) {
/* set resume return address */
- PSPR = virt_to_phys(cpu_resume);
+ PSPR = __pa_symbol(cpu_resume);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,175 |
--- initial
+++ final
@@ -1,31 +1,31 @@
static int sun6i_smp_boot_secondary(unsigned int cpu, struct task_struct *idle) {
u32 reg;
int i;
if (!(prcm_membase && cpucfg_membase)) return -EFAULT;
spin_lock(&cpu_lock);
/* Set CPU boot address */
- writel(virt_to_phys(secondary_startup), cpucfg_membase + CPUCFG_PRIVATE0_REG);
+ writel(__pa_symbol(secondary_startup), cpucfg_membase + CPUCFG_PRIVATE0_REG);
/* Assert the CPU core in reset */
writel(0, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
/* Assert the L1 cache in reset */
reg = readl(cpucfg_membase + CPUCFG_GEN_CTRL_REG);
writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_GEN_CTRL_REG);
/* Disable external debug access */
reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
writel(reg & ~BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
/* Power up the CPU */
for (i = 0; i <= 8; i++)
writel(0xff >> i, prcm_membase + PRCM_CPU_PWR_CLAMP_REG(cpu));
mdelay(10);
/* Clear CPU power-off gating */
reg = readl(prcm_membase + PRCM_CPU_PWROFF_REG);
writel(reg & ~BIT(cpu), prcm_membase + PRCM_CPU_PWROFF_REG);
mdelay(1);
/* Deassert the CPU core reset */
writel(3, cpucfg_membase + CPUCFG_CPU_RST_CTRL_REG(cpu));
/* Enable back the external debug accesses */
reg = readl(cpucfg_membase + CPUCFG_DBG_CTL1_REG);
writel(reg | BIT(cpu), cpucfg_membase + CPUCFG_DBG_CTL1_REG);
spin_unlock(&cpu_lock);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,145 |
--- initial
+++ final
@@ -1,5 +1,5 @@
void mcpm_set_entry_vector(unsigned cpu, unsigned cluster, void *ptr) {
- unsigned long val = ptr ? virt_to_phys(ptr) : 0;
+ unsigned long val = ptr ? __pa_symbol(ptr) : 0;
mcpm_entry_vectors[cluster][cpu] = val;
sync_cache_w(&mcpm_entry_vectors[cluster][cpu]);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,153 |
--- initial
+++ final
@@ -1,9 +1,9 @@
static int palmz72_pm_suspend(void) {
/* setup the resume_info struct for the original bootloader */
palmz72_resume_info.resume_addr = (u32)cpu_resume;
/* Storing memory touched by ROM */
store_ptr = *PALMZ72_SAVE_DWORD;
/* Setting PSPR to a proper value */
- PSPR = virt_to_phys(&palmz72_resume_info);
+ PSPR = __pa_symbol(&palmz72_resume_info);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,160 |
--- initial
+++ final
@@ -1,11 +1,11 @@
static void __init ls1021a_smp_prepare_cpus(unsigned int max_cpus) {
struct device_node *np;
void __iomem *dcfg_base;
unsigned long paddr;
np = of_find_compatible_node(NULL, NULL, "fsl,ls1021a-dcfg");
dcfg_base = of_iomap(np, 0);
BUG_ON(!dcfg_base);
- paddr = virt_to_phys(secondary_startup);
+ paddr = __pa_symbol(secondary_startup);
writel_relaxed(cpu_to_be32(paddr), dcfg_base + DCFG_CCSR_SCRATCHRW1);
iounmap(dcfg_base);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,129 |
--- initial
+++ final
@@ -1,30 +1,30 @@
static void __init berlin_smp_prepare_cpus(unsigned int max_cpus) {
struct device_node *np;
void __iomem *scu_base;
void __iomem *vectors_base;
np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
scu_base = of_iomap(np, 0);
of_node_put(np);
if (!scu_base) return;
np = of_find_compatible_node(NULL, NULL, "marvell,berlin-cpu-ctrl");
cpu_ctrl = of_iomap(np, 0);
of_node_put(np);
if (!cpu_ctrl) goto unmap_scu;
vectors_base = ioremap(CONFIG_VECTORS_BASE, SZ_32K);
if (!vectors_base) goto unmap_scu;
scu_enable(scu_base);
flush_cache_all();
/*
* Write the first instruction the CPU will execute after being reset
* in the reset exception vector.
*/
writel(boot_inst, vectors_base + RESET_VECT);
/*
* Write the secondary startup address into the SW reset address
* vector. This is used by boot_inst.
*/
- writel(virt_to_phys(secondary_startup), vectors_base + SW_RESET_ADDR);
+ writel(__pa_symbol(secondary_startup), vectors_base + SW_RESET_ADDR);
iounmap(vectors_base);
unmap_scu:
iounmap(scu_base);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,120 |
--- initial
+++ final
@@ -1,48 +1,48 @@
static int sirfsoc_boot_secondary(unsigned int cpu, struct task_struct *idle) {
unsigned long timeout;
struct device_node *np;
np = of_find_matching_node(NULL, clk_ids);
if (!np) return -ENODEV;
clk_base = of_iomap(np, 0);
if (!clk_base) return -ENOMEM;
/*
* write the address of secondary startup into the clkc register
* at offset 0x2bC, then write the magic number 0x3CAF5D62 to the
* clkc register at offset 0x2b8, which is what boot rom code is
* waiting for. This would wake up the secondary core from WFE
*/
#define SIRFSOC_CPU1_JUMPADDR_OFFSET 0x2bc
- __raw_writel(virt_to_phys(sirfsoc_secondary_startup), clk_base + SIRFSOC_CPU1_JUMPADDR_OFFSET);
+ __raw_writel(__pa_symbol(sirfsoc_secondary_startup), clk_base + SIRFSOC_CPU1_JUMPADDR_OFFSET);
#define SIRFSOC_CPU1_WAKEMAGIC_OFFSET 0x2b8
__raw_writel(0x3CAF5D62, clk_base + SIRFSOC_CPU1_WAKEMAGIC_OFFSET);
/* make sure write buffer is drained */
mb();
spin_lock(&boot_lock);
/*
* The secondary processor is waiting to be released from
* the holding pen - release it, then wait for it to flag
* that it has been released by resetting pen_release.
*
* Note that "pen_release" is the hardware CPU ID, whereas
* "cpu" is Linux's internal ID.
*/
pen_release = cpu_logical_map(cpu);
sync_cache_w(&pen_release);
/*
* Send the secondary CPU SEV, thereby causing the boot monitor to read
* the JUMPADDR and WAKEMAGIC, and branch to the address found there.
*/
dsb_sev();
timeout = jiffies + (1 * HZ);
while (time_before(jiffies, timeout)) {
smp_rmb();
if (pen_release == -1) break;
udelay(10);
}
/*
* now the secondary core is starting up let it run its
* calibrations, then wait for it to finish
*/
spin_unlock(&boot_lock);
return pen_release != -1 ? -ENOSYS : 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,133 |
--- initial
+++ final
@@ -1,9 +1,9 @@
static int alpine_boot_secondary(unsigned int cpu, struct task_struct *idle) {
phys_addr_t addr;
- addr = virt_to_phys(secondary_startup);
+ addr = __pa_symbol(secondary_startup);
if (addr > (phys_addr_t)(uint32_t)(-1)) {
pr_err("FAIL: resume address over 32bit (%pa)", &addr);
return -EINVAL;
}
return alpine_cpu_wakeup(cpu_logical_map(cpu), (uint32_t)addr);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,116 |
--- initial
+++ final
@@ -1,41 +1,41 @@
static void __init sti_smp_prepare_cpus(unsigned int max_cpus) {
struct device_node *np;
void __iomem *scu_base;
u32 __iomem *cpu_strt_ptr;
u32 release_phys;
int cpu;
- unsigned long entry_pa = virt_to_phys(sti_secondary_startup);
+ unsigned long entry_pa = __pa_symbol(sti_secondary_startup);
np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
if (np) {
scu_base = of_iomap(np, 0);
scu_enable(scu_base);
of_node_put(np);
}
if (max_cpus <= 1) return;
for_each_possible_cpu(cpu) {
np = of_get_cpu_node(cpu, NULL);
if (!np) continue;
if (of_property_read_u32(np, "cpu-release-addr", &release_phys)) {
pr_err("CPU %d: missing or invalid cpu-release-addr "
"property\n",
cpu);
continue;
}
/*
* holding pen is usually configured in SBC DMEM but can also be
* in RAM.
*/
if (!memblock_is_memory(release_phys))
cpu_strt_ptr = ioremap(release_phys, sizeof(release_phys));
else
cpu_strt_ptr = (u32 __iomem *)phys_to_virt(release_phys);
__raw_writel(entry_pa, cpu_strt_ptr);
/*
* wmb so that data is actually written
* before cache flush is done
*/
smp_wmb();
sync_cache_w(cpu_strt_ptr);
if (!memblock_is_memory(release_phys)) iounmap(cpu_strt_ptr);
}
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,144 |
--- initial
+++ final
@@ -1,5 +1,5 @@
static int shmobile_scu_cpu_prepare(unsigned int cpu) {
/* For this particular CPU register SCU SMP boot vector */
- shmobile_smp_hook(cpu, virt_to_phys(shmobile_boot_scu), shmobile_scu_base_phys);
+ shmobile_smp_hook(cpu, __pa_symbol(shmobile_boot_scu), shmobile_scu_base_phys);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,167 |
--- initial
+++ final
@@ -1,31 +1,31 @@
static void pxa3xx_cpu_pm_suspend(void) {
volatile unsigned long *p = (volatile void *)0xc0000000;
unsigned long saved_data = *p;
#ifndef CONFIG_IWMMXT
u64 acc0;
asm volatile(".arch_extension xscale\n\t"
"mra %Q0, %R0, acc0"
: "=r"(acc0));
#endif
/* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */
CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM);
CKENB |= 1 << (CKEN_HSIO2 & 0x1f);
/* clear and setup wakeup source */
AD3SR = ~0;
AD3ER = wakeup_src;
ASCR = ASCR;
ARSR = ARSR;
PCFR |= (1u << 13); /* L1_DIS */
PCFR &= ~((1u << 12) | (1u << 1)); /* L0_EN | SL_ROD */
PSPR = 0x5c014000;
/* overwrite with the resume address */
- *p = virt_to_phys(cpu_resume);
+ *p = __pa_symbol(cpu_resume);
cpu_suspend(0, pxa3xx_finish_suspend);
*p = saved_data;
AD3ER = 0;
#ifndef CONFIG_IWMMXT
asm volatile(".arch_extension xscale\n\t"
"mar acc0, %Q0, %R0"
: "=r"(acc0));
#endif
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,177 |
--- initial
+++ final
@@ -1,45 +1,45 @@
void __init zx_smp_prepare_cpus(unsigned int max_cpus) {
struct device_node *np;
unsigned long base = 0;
void __iomem *aonsysctrl_base;
void __iomem *sys_iram;
base = scu_a9_get_base();
scu_base = ioremap(base, SZ_256);
if (!scu_base) {
pr_err("%s: failed to map scu\n", __func__);
return;
}
scu_enable(scu_base);
np = of_find_compatible_node(NULL, NULL, "zte,sysctrl");
if (!np) {
pr_err("%s: failed to find sysctrl node\n", __func__);
return;
}
aonsysctrl_base = of_iomap(np, 0);
if (!aonsysctrl_base) {
pr_err("%s: failed to map aonsysctrl\n", __func__);
of_node_put(np);
return;
}
/*
* Write the address of secondary startup into the
* system-wide flags register. The BootMonitor waits
* until it receives a soft interrupt, and then the
* secondary CPU branches to this address.
*/
- __raw_writel(virt_to_phys(zx_secondary_startup), aonsysctrl_base + AON_SYS_CTRL_RESERVED1);
+ __raw_writel(__pa_symbol(zx_secondary_startup), aonsysctrl_base + AON_SYS_CTRL_RESERVED1);
iounmap(aonsysctrl_base);
of_node_put(np);
np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
pcu_base = of_iomap(np, 0);
of_node_put(np);
WARN_ON(!pcu_base);
np = of_find_compatible_node(NULL, NULL, "zte,zx-bus-matrix");
matrix_base = of_iomap(np, 0);
of_node_put(np);
WARN_ON(!matrix_base);
/* Map the first 4 KB IRAM for suspend usage */
sys_iram = __arm_ioremap_exec(ZX_IRAM_BASE, PAGE_SIZE, false);
- zx_secondary_startup_pa = virt_to_phys(zx_secondary_startup);
+ zx_secondary_startup_pa = __pa_symbol(zx_secondary_startup);
fncpy(sys_iram, &zx_resume_jump, zx_suspend_iram_sz);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,150 |
--- initial
+++ final
@@ -1,11 +1,11 @@
static void exynos_mcpm_setup_entry_point(void) {
/*
* U-Boot SPL is hardcoded to jump to the start of ns_sram_base_addr
* as part of secondary_cpu_start(). Let's redirect it to the
* mcpm_entry_point(). This is done during both secondary boot-up as
* well as system resume.
*/
__raw_writel(0xe59f0000, ns_sram_base_addr); /* ldr r0, [pc, #0] */
__raw_writel(0xe12fff10, ns_sram_base_addr + 4); /* bx r0 */
- __raw_writel(virt_to_phys(mcpm_entry_point), ns_sram_base_addr + 8);
+ __raw_writel(__pa_symbol(mcpm_entry_point), ns_sram_base_addr + 8);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,151 |
--- initial
+++ final
@@ -1,18 +1,18 @@
static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle) {
phys_addr_t jumpaddr;
unsigned int remap_reg_value = 0;
struct device_node *node;
- jumpaddr = virt_to_phys(secondary_startup);
+ jumpaddr = __pa_symbol(secondary_startup);
hip01_set_boot_addr(HIP01_BOOT_ADDRESS, jumpaddr);
node = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl");
if (WARN_ON(!node)) return -1;
ctrl_base = of_iomap(node, 0);
/* set the secondary core boot from DDR */
remap_reg_value = readl_relaxed(ctrl_base + REG_SC_CTRL);
barrier();
remap_reg_value |= SC_SCTL_REMAP_CLR;
barrier();
writel_relaxed(remap_reg_value, ctrl_base + REG_SC_CTRL);
hip01_set_cpu(cpu, true);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,127 |
--- initial
+++ final
@@ -1,17 +1,17 @@
static int __init nocache_trampoline(unsigned long _arg) {
void (*cache_disable)(void) = (void *)_arg;
unsigned int mpidr = read_cpuid_mpidr();
unsigned int cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
unsigned int cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
phys_reset_t phys_reset;
mcpm_set_entry_vector(cpu, cluster, cpu_resume);
setup_mm_for_reboot();
__mcpm_cpu_going_down(cpu, cluster);
BUG_ON(!__mcpm_outbound_enter_critical(cpu, cluster));
cache_disable();
__mcpm_outbound_leave_critical(cluster, CLUSTER_DOWN);
__mcpm_cpu_down(cpu, cluster);
- phys_reset = (phys_reset_t)(unsigned long)virt_to_phys(cpu_reset);
- phys_reset(virt_to_phys(mcpm_entry_point));
+ phys_reset = (phys_reset_t)(unsigned long)__pa_symbol(cpu_reset);
+ phys_reset(__pa_symbol(mcpm_entry_point));
BUG();
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,155 |
--- initial
+++ final
@@ -1,58 +1,58 @@
int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state) {
struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
unsigned int save_state = 0, cpu_logic_state = PWRDM_POWER_RET;
unsigned int wakeup_cpu;
if (omap_rev() == OMAP4430_REV_ES1_0) return -ENXIO;
switch (power_state) {
case PWRDM_POWER_ON:
case PWRDM_POWER_INACTIVE: save_state = 0; break;
case PWRDM_POWER_OFF:
cpu_logic_state = PWRDM_POWER_OFF;
save_state = 1;
break;
case PWRDM_POWER_RET:
if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) save_state = 0;
break;
default:
/*
* CPUx CSWR is invalid hardware state. Also CPUx OSWR
* doesn't make much scense, since logic is lost and $L1
* needs to be cleaned because of coherency. This makes
* CPUx OSWR equivalent to CPUX OFF and hence not supported
*/
WARN_ON(1);
return -ENXIO;
}
pwrdm_pre_transition(NULL);
/*
* Check MPUSS next state and save interrupt controller if needed.
* In MPUSS OSWR or device OFF, interrupt controller contest is lost.
*/
mpuss_clear_prev_logic_pwrst();
if ((pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_RET) && (pwrdm_read_logic_retst(mpuss_pd) == PWRDM_POWER_OFF)) save_state = 2;
cpu_clear_prev_logic_pwrst(cpu);
pwrdm_set_next_pwrst(pm_info->pwrdm, power_state);
pwrdm_set_logic_retst(pm_info->pwrdm, cpu_logic_state);
- set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.resume));
+ set_cpu_wakeup_addr(cpu, __pa_symbol(omap_pm_ops.resume));
omap_pm_ops.scu_prepare(cpu, power_state);
l2x0_pwrst_prepare(cpu, save_state);
/*
* Call low level function with targeted low power state.
*/
if (save_state)
cpu_suspend(save_state, omap_pm_ops.finish_suspend);
else
omap_pm_ops.finish_suspend(save_state);
if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD) && cpu) gic_dist_enable();
/*
* Restore the CPUx power state to ON otherwise CPUx
* power domain can transitions to programmed low power
* state while doing WFI outside the low powe code. On
* secure devices, CPUx does WFI which can result in
* domain transition
*/
wakeup_cpu = smp_processor_id();
pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON);
pwrdm_post_transition(NULL);
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,156 |
--- initial
+++ final
@@ -1,14 +1,14 @@
static int socfpga_a10_boot_secondary(unsigned int cpu, struct task_struct *idle) {
int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
if (socfpga_cpu1start_addr) {
writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_MODMPURST);
memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
- writel(virt_to_phys(secondary_startup), sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff));
+ writel(__pa_symbol(secondary_startup), sys_manager_base_addr + (socfpga_cpu1start_addr & 0x00000fff));
flush_cache_all();
smp_wmb();
outer_clean_range(0, trampoline_size);
/* This will release CPU #1 out of reset. */
writel(0, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_MODMPURST);
}
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,141 |
--- initial
+++ final
@@ -1,39 +1,39 @@
static int kona_boot_secondary(unsigned int cpu, struct task_struct *idle) {
void __iomem *boot_reg;
phys_addr_t boot_func;
u64 start_clock;
u32 cpu_id;
u32 boot_val;
bool timeout = false;
const u32 secondary_boot_addr = secondary_boot_addr_for(cpu);
cpu_id = cpu_logical_map(cpu);
if (cpu_id & ~BOOT_ADDR_CPUID_MASK) {
pr_err("bad cpu id (%u > %u)\n", cpu_id, BOOT_ADDR_CPUID_MASK);
return -EINVAL;
}
if (!secondary_boot_addr) return -EINVAL;
boot_reg = ioremap_nocache((phys_addr_t)secondary_boot_addr, sizeof(phys_addr_t));
if (!boot_reg) {
pr_err("unable to map boot register for cpu %u\n", cpu_id);
return -ENOMEM;
}
/*
* Secondary cores will start in secondary_startup(),
* defined in "arch/arm/kernel/head.S"
*/
- boot_func = virt_to_phys(secondary_startup);
+ boot_func = __pa_symbol(secondary_startup);
BUG_ON(boot_func & BOOT_ADDR_CPUID_MASK);
BUG_ON(boot_func > (phys_addr_t)U32_MAX);
/* The core to start is encoded in the low bits */
boot_val = (u32)boot_func | cpu_id;
writel_relaxed(boot_val, boot_reg);
sev();
/* The low bits will be cleared once the core has started */
start_clock = local_clock();
while (!timeout && readl_relaxed(boot_reg) == boot_val)
timeout = local_clock() - start_clock > SECONDARY_TIMEOUT_NS;
iounmap(boot_reg);
if (!timeout) return 0;
pr_err("timeout waiting for cpu %u to start\n", cpu_id);
return -ENXIO;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,118 |
--- initial
+++ final
@@ -1 +1 @@
-static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle) { return zynq_cpun_start(virt_to_phys(secondary_startup), cpu); }
+static int zynq_boot_secondary(unsigned int cpu, struct task_struct *idle) { return zynq_cpun_start(__pa_symbol(secondary_startup), cpu); }<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,169 |
--- initial
+++ final
@@ -1,17 +1,17 @@
void __init omap4_mpuss_early_init(void) {
unsigned long startup_pa;
if (!(cpu_is_omap44xx() || soc_is_omap54xx())) return;
sar_base = omap4_get_sar_ram_base();
if (cpu_is_omap443x())
- startup_pa = virt_to_phys(omap4_secondary_startup);
+ startup_pa = __pa_symbol(omap4_secondary_startup);
else if (cpu_is_omap446x())
- startup_pa = virt_to_phys(omap4460_secondary_startup);
+ startup_pa = __pa_symbol(omap4460_secondary_startup);
else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE)
- startup_pa = virt_to_phys(omap5_secondary_hyp_startup);
+ startup_pa = __pa_symbol(omap5_secondary_hyp_startup);
else
- startup_pa = virt_to_phys(omap5_secondary_startup);
+ startup_pa = __pa_symbol(omap5_secondary_startup);
if (cpu_is_omap44xx())
writel_relaxed(startup_pa, sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
else
writel_relaxed(startup_pa, sar_base + OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,158 |
--- initial
+++ final
@@ -1,15 +1,15 @@
static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle) {
int trampoline_size = &secondary_trampoline_end - &secondary_trampoline;
if (socfpga_cpu1start_addr) {
/* This will put CPU #1 into reset. */
writel(RSTMGR_MPUMODRST_CPU1, rst_manager_base_addr + SOCFPGA_RSTMGR_MODMPURST);
memcpy(phys_to_virt(0), &secondary_trampoline, trampoline_size);
- writel(virt_to_phys(secondary_startup), sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
+ writel(__pa_symbol(secondary_startup), sys_manager_base_addr + (socfpga_cpu1start_addr & 0x000000ff));
flush_cache_all();
smp_wmb();
outer_clean_range(0, trampoline_size);
/* This will release CPU #1 out of reset. */
writel(0, rst_manager_base_addr + SOCFPGA_RSTMGR_MODMPURST);
}
return 0;
}<sep>@@
expression e;
@@
- virt_to_phys
+ __pa_symbol
(e)
<|end_of_text|> | 9,142 |
--- initial
+++ final
@@ -1,13 +1,10 @@
static void snd_mpu401_uart_add_timer(struct snd_mpu401 *mpu, int input) {
unsigned long flags;
spin_lock_irqsave(&mpu->timer_lock, flags);
if (mpu->timer_invoked == 0) {
- init_timer(&mpu->timer);
- mpu->timer.data = (unsigned long)mpu;
- mpu->timer.function = snd_mpu401_uart_timer;
- mpu->timer.expires = 1 + jiffies;
- add_timer(&mpu->timer);
+ setup_timer(&mpu->timer, snd_mpu401_uart_timer, (unsigned long)mpu);
+ mod_timer(&mpu->timer, 1 + jiffies);
}
mpu->timer_invoked |= input ? MPU401_MODE_INPUT_TIMER : MPU401_MODE_OUTPUT_TIMER;
spin_unlock_irqrestore(&mpu->timer_lock, flags);
}<sep>@@
expression E0;
expression E1,e1;
expression E2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.function = e1;
- E0.data = E2;
... when != init_timer(&E0);
- E0.function = E1;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,182 |
--- initial
+++ final
@@ -1,102 +1,100 @@
static int idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id) {
static struct idt77252_dev **last = &idt77252_chain;
static int index = 0;
unsigned long membase, srambase;
struct idt77252_dev *card;
struct atm_dev *dev;
int i, err;
if ((err = pci_enable_device(pcidev))) {
printk("idt77252: can't enable PCI device at %s\n", pci_name(pcidev));
return err;
}
if ((err = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32)))) {
printk("idt77252: can't enable DMA for PCI device at %s\n", pci_name(pcidev));
return err;
}
card = kzalloc(sizeof(struct idt77252_dev), GFP_KERNEL);
if (!card) {
printk("idt77252-%d: can't allocate private data\n", index);
err = -ENOMEM;
goto err_out_disable_pdev;
}
card->revision = pcidev->revision;
card->index = index;
card->pcidev = pcidev;
sprintf(card->name, "idt77252-%d", card->index);
INIT_WORK(&card->tqueue, idt77252_softint);
membase = pci_resource_start(pcidev, 1);
srambase = pci_resource_start(pcidev, 2);
mutex_init(&card->mutex);
spin_lock_init(&card->cmd_lock);
spin_lock_init(&card->tst_lock);
- init_timer(&card->tst_timer);
- card->tst_timer.data = (unsigned long)card;
- card->tst_timer.function = tst_timer;
+ setup_timer(&card->tst_timer, tst_timer, (unsigned long)card);
/* Do the I/O remapping... */
card->membase = ioremap(membase, 1024);
if (!card->membase) {
printk("%s: can't ioremap() membase\n", card->name);
err = -EIO;
goto err_out_free_card;
}
if (idt77252_preset(card)) {
printk("%s: preset failed\n", card->name);
err = -EIO;
goto err_out_iounmap;
}
dev = atm_dev_register("idt77252", &pcidev->dev, &idt77252_ops, -1, NULL);
if (!dev) {
printk("%s: can't register atm device\n", card->name);
err = -EIO;
goto err_out_iounmap;
}
dev->dev_data = card;
card->atmdev = dev;
#ifdef CONFIG_ATM_IDT77252_USE_SUNI
suni_init(dev);
if (!dev->phy) {
printk("%s: can't init SUNI\n", card->name);
err = -EIO;
goto err_out_deinit_card;
}
#endif /* CONFIG_ATM_IDT77252_USE_SUNI */
card->sramsize = probe_sram(card);
for (i = 0; i < 4; i++) {
card->fbq[i] = ioremap(srambase | 0x200000 | (i << 18), 4);
if (!card->fbq[i]) {
printk("%s: can't ioremap() FBQ%d\n", card->name, i);
err = -EIO;
goto err_out_deinit_card;
}
}
printk("%s: ABR SAR (Rev %c): MEM %08lx SRAM %08lx [%u KB]\n", card->name, ((card->revision > 1) && (card->revision < 25)) ? 'A' + card->revision - 1 : '?', membase, srambase, card->sramsize / 1024);
if (init_card(dev)) {
printk("%s: init_card failed\n", card->name);
err = -EIO;
goto err_out_deinit_card;
}
dev->ci_range.vpi_bits = card->vpibits;
dev->ci_range.vci_bits = card->vcibits;
dev->link_rate = card->link_pcr;
if (dev->phy->start) dev->phy->start(dev);
if (idt77252_dev_open(card)) {
printk("%s: dev_open failed\n", card->name);
err = -EIO;
goto err_out_stop;
}
*last = card;
last = &card->next;
index++;
return 0;
err_out_stop:
if (dev->phy->stop) dev->phy->stop(dev);
err_out_deinit_card:
deinit_card(card);
err_out_iounmap:
iounmap(card->membase);
err_out_free_card:
kfree(card);
err_out_disable_pdev:
pci_disable_device(pcidev);
return err;
}<sep>@@
expression E0;
expression E1,e1;
expression E2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.function = e1;
- E0.data = E2;
... when != init_timer(&E0);
- E0.function = E1;
<|end_of_text|> | 1,240 |
--- initial
+++ final
@@ -1,20 +1,17 @@
static void snd_sb8dsp_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) {
unsigned long flags;
struct snd_sb *chip;
chip = substream->rmidi->private_data;
spin_lock_irqsave(&chip->open_lock, flags);
if (up) {
if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) {
- init_timer(&chip->midi_timer);
- chip->midi_timer.function = snd_sb8dsp_midi_output_timer;
- chip->midi_timer.data = (unsigned long)substream;
- chip->midi_timer.expires = 1 + jiffies;
- add_timer(&chip->midi_timer);
+ setup_timer(&chip->midi_timer, snd_sb8dsp_midi_output_timer, (unsigned long)substream);
+ mod_timer(&chip->midi_timer, 1 + jiffies);
chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER;
}
} else {
if (chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER) { chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER; }
}
spin_unlock_irqrestore(&chip->open_lock, flags);
if (up) snd_sb8dsp_midi_output_write(substream);
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,196 |
--- initial
+++ final
@@ -1,18 +1,17 @@
static int srmcons_open(struct tty_struct *tty, struct file *filp) {
struct srmcons_private *srmconsp;
unsigned long flags;
int retval;
retval = srmcons_get_private_struct(&srmconsp);
if (retval) return retval;
spin_lock_irqsave(&srmconsp->lock, flags);
if (!srmconsp->tty) {
tty->driver_data = srmconsp;
srmconsp->tty = tty;
srmconsp->timer.function = srmcons_receive_chars;
srmconsp->timer.data = (unsigned long)srmconsp;
- srmconsp->timer.expires = jiffies + 10;
- add_timer(&srmconsp->timer);
+ mod_timer(&srmconsp->timer, jiffies + 10);
}
spin_unlock_irqrestore(&srmconsp->lock, flags);
return 0;
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,178 |
--- initial
+++ final
@@ -1,20 +1,17 @@
static void snd_hdsp_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) {
struct hdsp_midi *hmidi;
unsigned long flags;
hmidi = (struct hdsp_midi *)substream->rmidi->private_data;
spin_lock_irqsave(&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
- init_timer(&hmidi->timer);
- hmidi->timer.function = snd_hdsp_midi_output_timer;
- hmidi->timer.data = (unsigned long)hmidi;
- hmidi->timer.expires = 1 + jiffies;
- add_timer(&hmidi->timer);
+ setup_timer(&hmidi->timer, snd_hdsp_midi_output_timer, (unsigned long)hmidi);
+ mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
} else {
if (hmidi->istimer && --hmidi->istimer <= 0) del_timer(&hmidi->timer);
}
spin_unlock_irqrestore(&hmidi->lock, flags);
if (up) snd_hdsp_midi_output_write(hmidi);
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,206 |
--- initial
+++ final
@@ -1,30 +1,27 @@
void pcbit_fsm_event(struct pcbit_dev *dev, struct pcbit_chan *chan, unsigned short event, struct callb_data *data) {
struct fsm_entry *action;
struct fsm_timer_entry *tentry;
unsigned long flags;
spin_lock_irqsave(&dev->lock, flags);
for (action = fsm_table; action->init != 0xff; action++)
if (action->init == chan->fsm_state && action->event == event) break;
if (action->init == 0xff) {
spin_unlock_irqrestore(&dev->lock, flags);
printk(KERN_DEBUG "fsm error: event %x on state %x\n", event, chan->fsm_state);
return;
}
if (chan->fsm_timer.function) {
del_timer(&chan->fsm_timer);
chan->fsm_timer.function = NULL;
}
chan->fsm_state = action->final;
pcbit_state_change(dev, chan, action->init, event, action->final);
for (tentry = fsm_timers; tentry->init != 0xff; tentry++)
if (tentry->init == chan->fsm_state) break;
if (tentry->init != 0xff) {
- init_timer(&chan->fsm_timer);
- chan->fsm_timer.function = &pcbit_fsm_timer;
- chan->fsm_timer.data = (ulong)chan;
- chan->fsm_timer.expires = jiffies + tentry->timeout * HZ;
- add_timer(&chan->fsm_timer);
+ setup_timer(&chan->fsm_timer, &pcbit_fsm_timer, (ulong)chan);
+ mod_timer(&chan->fsm_timer, jiffies + tentry->timeout * HZ);
}
spin_unlock_irqrestore(&dev->lock, flags);
if (action->callb) action->callb(dev, chan, data);
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,228 |
--- initial
+++ final
@@ -1,58 +1,56 @@
static int snd_uart16550_create(struct snd_card *card, unsigned long iobase, int irq, unsigned int speed, unsigned int base, int adaptor, int droponfull, struct snd_uart16550 **ruart) {
static struct snd_device_ops ops = {
.dev_free = snd_uart16550_dev_free,
};
struct snd_uart16550 *uart;
int err;
if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL) return -ENOMEM;
uart->adaptor = adaptor;
uart->card = card;
spin_lock_init(&uart->open_lock);
uart->irq = -1;
uart->base = iobase;
uart->drop_on_full = droponfull;
if ((err = snd_uart16550_detect(uart)) <= 0) {
printk(KERN_ERR "no UART detected at 0x%lx\n", iobase);
snd_uart16550_free(uart);
return -ENODEV;
}
if (irq >= 0 && irq != SNDRV_AUTO_IRQ) {
if (request_irq(irq, snd_uart16550_interrupt, 0, "Serial MIDI", uart)) {
snd_printk(KERN_WARNING "irq %d busy. Using Polling.\n", irq);
} else {
uart->irq = irq;
}
}
uart->divisor = base / speed;
uart->speed = base / (unsigned int)uart->divisor;
uart->speed_base = base;
uart->prev_out = -1;
uart->prev_in = 0;
uart->rstatus = 0;
memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
- init_timer(&uart->buffer_timer);
- uart->buffer_timer.function = snd_uart16550_buffer_timer;
- uart->buffer_timer.data = (unsigned long)uart;
+ setup_timer(&uart->buffer_timer, snd_uart16550_buffer_timer, (unsigned long)uart);
uart->timer_running = 0;
/* Register device */
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, uart, &ops)) < 0) {
snd_uart16550_free(uart);
return err;
}
switch (uart->adaptor) {
case SNDRV_SERIAL_MS124W_SA:
case SNDRV_SERIAL_MS124W_MB:
/* MS-124W can draw power from RTS and DTR if they
are in opposite states. */
outb(UART_MCR_RTS | (0 & UART_MCR_DTR), uart->base + UART_MCR);
break;
case SNDRV_SERIAL_MS124T:
/* MS-124T can draw power from RTS and/or DTR (preferably
both) if they are asserted. */
outb(UART_MCR_RTS | UART_MCR_DTR, uart->base + UART_MCR);
break;
default: break;
}
if (ruart) *ruart = uart;
return 0;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
<|end_of_text|> | 1,188 |
--- initial
+++ final
@@ -1,100 +1,97 @@
static int pd6729_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) {
int i, j, ret;
u_int mask;
char configbyte;
struct pd6729_socket *socket;
socket = kzalloc(sizeof(struct pd6729_socket) * MAX_SOCKETS, GFP_KERNEL);
if (!socket) {
dev_warn(&dev->dev, "failed to kzalloc socket.\n");
return -ENOMEM;
}
ret = pci_enable_device(dev);
if (ret) {
dev_warn(&dev->dev, "failed to enable pci_device.\n");
goto err_out_free_mem;
}
if (!pci_resource_start(dev, 0)) {
dev_warn(&dev->dev, "refusing to load the driver as the "
"io_base is NULL.\n");
ret = -ENOMEM;
goto err_out_disable;
}
dev_info(&dev->dev,
"Cirrus PD6729 PCI to PCMCIA Bridge at 0x%llx "
"on irq %d\n",
(unsigned long long)pci_resource_start(dev, 0), dev->irq);
/*
* Since we have no memory BARs some firmware may not
* have had PCI_COMMAND_MEMORY enabled, yet the device needs it.
*/
pci_read_config_byte(dev, PCI_COMMAND, &configbyte);
if (!(configbyte & PCI_COMMAND_MEMORY)) {
dev_dbg(&dev->dev, "pd6729: Enabling PCI_COMMAND_MEMORY.\n");
configbyte |= PCI_COMMAND_MEMORY;
pci_write_config_byte(dev, PCI_COMMAND, configbyte);
}
ret = pci_request_regions(dev, "pd6729");
if (ret) {
dev_warn(&dev->dev, "pci request region failed.\n");
goto err_out_disable;
}
if (dev->irq == NO_IRQ) irq_mode = 0; /* fall back to ISA interrupt mode */
mask = pd6729_isa_scan();
if (irq_mode == 0 && mask == 0) {
dev_warn(&dev->dev, "no ISA interrupt is available.\n");
ret = -ENODEV;
goto err_out_free_res;
}
for (i = 0; i < MAX_SOCKETS; i++) {
socket[i].io_base = pci_resource_start(dev, 0);
socket[i].socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD;
socket[i].socket.map_size = 0x1000;
socket[i].socket.irq_mask = mask;
socket[i].socket.pci_irq = dev->irq;
socket[i].socket.cb_dev = dev;
socket[i].socket.owner = THIS_MODULE;
socket[i].number = i;
socket[i].socket.ops = &pd6729_operations;
socket[i].socket.resource_ops = &pccard_nonstatic_ops;
socket[i].socket.dev.parent = &dev->dev;
socket[i].socket.driver_data = &socket[i];
}
pci_set_drvdata(dev, socket);
if (irq_mode == 1) {
/* Register the interrupt handler */
ret = request_irq(dev->irq, pd6729_interrupt, IRQF_SHARED, "pd6729", socket);
if (ret) {
dev_err(&dev->dev, "Failed to register irq %d\n", dev->irq);
goto err_out_free_res;
}
} else {
/* poll Card status change */
- init_timer(&socket->poll_timer);
- socket->poll_timer.function = pd6729_interrupt_wrapper;
- socket->poll_timer.data = (unsigned long)socket;
- socket->poll_timer.expires = jiffies + HZ;
- add_timer(&socket->poll_timer);
+ setup_timer(&socket->poll_timer, pd6729_interrupt_wrapper, (unsigned long)socket);
+ mod_timer(&socket->poll_timer, jiffies + HZ);
}
for (i = 0; i < MAX_SOCKETS; i++) {
ret = pcmcia_register_socket(&socket[i].socket);
if (ret) {
dev_warn(&dev->dev, "pcmcia_register_socket failed.\n");
for (j = 0; j < i; j++)
pcmcia_unregister_socket(&socket[j].socket);
goto err_out_free_res2;
}
}
return 0;
err_out_free_res2:
if (irq_mode == 1)
free_irq(dev->irq, socket);
else
del_timer_sync(&socket->poll_timer);
err_out_free_res:
pci_release_regions(dev);
err_out_disable:
pci_disable_device(dev);
err_out_free_mem:
kfree(socket);
return ret;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,212 |
--- initial
+++ final
@@ -1,18 +1,17 @@
void snd_ak4117_reinit(struct ak4117 *chip) {
unsigned char old = chip->regmap[AK4117_REG_PWRDN], reg;
del_timer(&chip->timer);
chip->init = 1;
/* bring the chip to reset state and powerdown state */
reg_write(chip, AK4117_REG_PWRDN, 0);
udelay(200);
/* release reset, but leave powerdown */
reg_write(chip, AK4117_REG_PWRDN, (old | AK4117_RST) & ~AK4117_PWN);
udelay(200);
for (reg = 1; reg < 5; reg++)
reg_write(chip, reg, chip->regmap[reg]);
/* release powerdown, everything is initialized now */
reg_write(chip, AK4117_REG_PWRDN, old | AK4117_RST | AK4117_PWN);
chip->init = 0;
- chip->timer.expires = 1 + jiffies;
- add_timer(&chip->timer);
+ mod_timer(&chip->timer, 1 + jiffies);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,190 |
--- initial
+++ final
@@ -1,12 +1,11 @@
static void hsr_check_announce(struct net_device *hsr_dev, unsigned char old_operstate) {
struct hsr_priv *hsr;
hsr = netdev_priv(hsr_dev);
if ((hsr_dev->operstate == IF_OPER_UP) && (old_operstate != IF_OPER_UP)) {
/* Went up */
hsr->announce_count = 0;
- hsr->announce_timer.expires = jiffies + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL);
- add_timer(&hsr->announce_timer);
+ mod_timer(&hsr->announce_timer, jiffies + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL));
}
if ((hsr_dev->operstate != IF_OPER_UP) && (old_operstate == IF_OPER_UP)) /* Went down */
del_timer(&hsr->announce_timer);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,232 |
--- initial
+++ final
@@ -1,80 +1,79 @@
static void icn_polldchan(unsigned long data) {
icn_card *card = (icn_card *)data;
int mch = card->secondhalf ? 2 : 0;
int avail = 0;
int left;
u_char c;
int ch;
unsigned long flags;
int i;
u_char *p;
isdn_ctrl cmd;
if (icn_trymaplock_channel(card, mch)) {
avail = msg_avail;
for (left = avail, i = readb(&msg_o); left > 0; i++, left--) {
c = readb(&dev.shmem->comm_buffers.iopc_buf[i & 0xff]);
icn_putmsg(card, c);
if (c == 0xff) {
card->imsg[card->iptr] = 0;
card->iptr = 0;
if (card->imsg[0] == '0' && card->imsg[1] >= '0' && card->imsg[1] <= '2' && card->imsg[2] == ';') {
ch = (card->imsg[1] - '0') - 1;
p = &card->imsg[3];
icn_parse_status(p, ch, card);
} else {
p = card->imsg;
if (!strncmp(p, "DRV1.", 5)) {
u_char vstr[10];
u_char *q = vstr;
printk(KERN_INFO "icn: (%s) %s\n", CID, p);
if (!strncmp(p + 7, "TC", 2)) {
card->ptype = ISDN_PTYPE_1TR6;
card->interface.features |= ISDN_FEATURE_P_1TR6;
printk(KERN_INFO "icn: (%s) 1TR6-Protocol loaded and running\n", CID);
}
if (!strncmp(p + 7, "EC", 2)) {
card->ptype = ISDN_PTYPE_EURO;
card->interface.features |= ISDN_FEATURE_P_EURO;
printk(KERN_INFO "icn: (%s) Euro-Protocol loaded and running\n", CID);
}
p = strstr(card->imsg, "BRV") + 3;
while (*p) {
if (*p >= '0' && *p <= '9') *q++ = *p;
p++;
}
*q = '\0';
strcat(vstr, "000");
vstr[3] = '\0';
card->fw_rev = (int)simple_strtoul(vstr, NULL, 10);
continue;
}
}
} else {
card->imsg[card->iptr] = c;
if (card->iptr < 59) card->iptr++;
}
}
writeb((readb(&msg_o) + avail) & 0xff, &msg_o);
icn_release_channel();
}
if (avail) {
cmd.command = ISDN_STAT_STAVAIL;
cmd.driver = card->myid;
cmd.arg = avail;
card->interface.statcallb(&cmd);
}
spin_lock_irqsave(&card->lock, flags);
if (card->flags & (ICN_FLAGS_B1ACTIVE | ICN_FLAGS_B2ACTIVE))
if (!(card->flags & ICN_FLAGS_RBTIMER)) {
/* schedule b-channel polling */
card->flags |= ICN_FLAGS_RBTIMER;
del_timer(&card->rb_timer);
card->rb_timer.function = icn_pollbchan;
card->rb_timer.data = (unsigned long)card;
- card->rb_timer.expires = jiffies + ICN_TIMER_BCREAD;
- add_timer(&card->rb_timer);
+ mod_timer(&card->rb_timer, jiffies + ICN_TIMER_BCREAD);
}
/* schedule again */
mod_timer(&card->st_timer, jiffies + ICN_TIMER_DCREAD);
spin_unlock_irqrestore(&card->lock, flags);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,225 |
--- initial
+++ final
@@ -1,41 +1,38 @@
static int toneport_try_init(struct usb_interface *interface, struct usb_line6 *line6) {
int err;
struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)line6;
if ((interface == NULL) || (toneport == NULL)) return -ENODEV;
line6->disconnect = line6_toneport_disconnect;
/* initialize audio system: */
err = line6_init_audio(line6);
if (err < 0) return err;
/* initialize PCM subsystem: */
err = line6_init_pcm(line6, &toneport_pcm_properties);
if (err < 0) return err;
/* register monitor control: */
err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_monitor, line6->line6pcm));
if (err < 0) return err;
/* register source select control: */
switch (line6->type) {
case LINE6_TONEPORT_UX1:
case LINE6_TONEPORT_UX2:
case LINE6_PODSTUDIO_UX1:
case LINE6_PODSTUDIO_UX2:
err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_source, line6->line6pcm));
if (err < 0) return err;
default: break;
}
/* register audio system: */
err = line6_register_audio(line6);
if (err < 0) return err;
line6_read_serial_number(line6, &toneport->serial_number);
line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
if (toneport_has_led(line6->type)) {
CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red));
CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green));
}
toneport_setup(toneport);
- init_timer(&toneport->timer);
- toneport->timer.expires = jiffies + TONEPORT_PCM_DELAY * HZ;
- toneport->timer.function = toneport_start_pcm;
- toneport->timer.data = (unsigned long)toneport;
- add_timer(&toneport->timer);
+ setup_timer(&toneport->timer, toneport_start_pcm, (unsigned long)toneport);
+ mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
return 0;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,209 |
--- initial
+++ final
@@ -1,8 +1,7 @@
static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart) {
if (!uart->timer_running) {
/* timer 38600bps * 10bit * 16byte */
- uart->buffer_timer.expires = jiffies + (HZ + 255) / 256;
uart->timer_running = 1;
- add_timer(&uart->buffer_timer);
+ mod_timer(&uart->buffer_timer, jiffies + (HZ + 255) / 256);
}
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,187 |
--- initial
+++ final
@@ -1,85 +1,82 @@
static int pasemi_mac_open(struct net_device *dev) {
struct pasemi_mac *mac = netdev_priv(dev);
unsigned int flags;
int i, ret;
flags = PAS_MAC_CFG_TXP_FCE | PAS_MAC_CFG_TXP_FPC(3) | PAS_MAC_CFG_TXP_SL(3) | PAS_MAC_CFG_TXP_COB(0xf) | PAS_MAC_CFG_TXP_TIFT(8) | PAS_MAC_CFG_TXP_TIFG(12);
write_mac_reg(mac, PAS_MAC_CFG_TXP, flags);
ret = pasemi_mac_setup_rx_resources(dev);
if (ret) goto out_rx_resources;
mac->tx = pasemi_mac_setup_tx_resources(dev);
if (!mac->tx) goto out_tx_ring;
/* We might already have allocated rings in case mtu was changed
* before interface was brought up.
*/
if (dev->mtu > 1500 && !mac->num_cs) {
pasemi_mac_setup_csrings(mac);
if (!mac->num_cs) goto out_tx_ring;
}
/* Zero out rmon counters */
for (i = 0; i < 32; i++)
write_mac_reg(mac, PAS_MAC_RMON(i), 0);
/* 0x3ff with 33MHz clock is about 31us */
write_iob_reg(PAS_IOB_DMA_COM_TIMEOUTCFG, PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0x3ff));
write_iob_reg(PAS_IOB_DMA_RXCH_CFG(mac->rx->chan.chno), PAS_IOB_DMA_RXCH_CFG_CNTTH(256));
write_iob_reg(PAS_IOB_DMA_TXCH_CFG(mac->tx->chan.chno), PAS_IOB_DMA_TXCH_CFG_CNTTH(32));
write_mac_reg(mac, PAS_MAC_IPC_CHNL, PAS_MAC_IPC_CHNL_DCHNO(mac->rx->chan.chno) | PAS_MAC_IPC_CHNL_BCH(mac->rx->chan.chno));
/* enable rx if */
write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), PAS_DMA_RXINT_RCMDSTA_EN | PAS_DMA_RXINT_RCMDSTA_DROPS_M | PAS_DMA_RXINT_RCMDSTA_BP | PAS_DMA_RXINT_RCMDSTA_OO | PAS_DMA_RXINT_RCMDSTA_BT);
/* enable rx channel */
pasemi_dma_start_chan(&rx_ring(mac)->chan, PAS_DMA_RXCHAN_CCMDSTA_DU | PAS_DMA_RXCHAN_CCMDSTA_OD | PAS_DMA_RXCHAN_CCMDSTA_FD | PAS_DMA_RXCHAN_CCMDSTA_DT);
/* enable tx channel */
pasemi_dma_start_chan(&tx_ring(mac)->chan, PAS_DMA_TXCHAN_TCMDSTA_SZ | PAS_DMA_TXCHAN_TCMDSTA_DB | PAS_DMA_TXCHAN_TCMDSTA_DE | PAS_DMA_TXCHAN_TCMDSTA_DA);
pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE);
write_dma_reg(PAS_DMA_RXCHAN_INCR(rx_ring(mac)->chan.chno), RX_RING_SIZE >> 1);
/* Clear out any residual packet count state from firmware */
pasemi_mac_restart_rx_intr(mac);
pasemi_mac_restart_tx_intr(mac);
flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
if (mac->type == MAC_TYPE_GMAC)
flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
else
flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
/* Enable interface in MAC */
write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
ret = pasemi_mac_phy_init(dev);
if (ret) {
/* Since we won't get link notification, just enable RX */
pasemi_mac_intf_enable(mac);
if (mac->type == MAC_TYPE_GMAC) {
/* Warn for missing PHY on SGMII (1Gig) ports */
dev_warn(&mac->pdev->dev, "PHY init failed: %d.\n", ret);
dev_warn(&mac->pdev->dev, "Defaulting to 1Gbit full duplex\n");
}
}
netif_start_queue(dev);
napi_enable(&mac->napi);
snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", dev->name);
ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, 0, mac->tx_irq_name, mac->tx);
if (ret) {
dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", mac->tx->chan.irq, ret);
goto out_tx_int;
}
snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", dev->name);
ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, 0, mac->rx_irq_name, mac->rx);
if (ret) {
dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", mac->rx->chan.irq, ret);
goto out_rx_int;
}
if (mac->phydev) phy_start(mac->phydev);
- init_timer(&mac->tx->clean_timer);
- mac->tx->clean_timer.function = pasemi_mac_tx_timer;
- mac->tx->clean_timer.data = (unsigned long)mac->tx;
- mac->tx->clean_timer.expires = jiffies + HZ;
- add_timer(&mac->tx->clean_timer);
+ setup_timer(&mac->tx->clean_timer, pasemi_mac_tx_timer, (unsigned long)mac->tx);
+ mod_timer(&mac->tx->clean_timer, jiffies + HZ);
return 0;
out_rx_int:
free_irq(mac->tx->chan.irq, mac->tx);
out_tx_int:
napi_disable(&mac->napi);
netif_stop_queue(dev);
out_tx_ring:
if (mac->tx) pasemi_mac_free_tx_resources(mac);
pasemi_mac_free_rx_resources(mac);
out_rx_resources:
return ret;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,223 |
--- initial
+++ final
@@ -1,10 +1,9 @@
static void snd_mpu401_uart_timer(unsigned long data) {
struct snd_mpu401 *mpu = (struct snd_mpu401 *)data;
unsigned long flags;
spin_lock_irqsave(&mpu->timer_lock, flags);
/*mpu->mode |= MPU401_MODE_TIMER;*/
- mpu->timer.expires = 1 + jiffies;
- add_timer(&mpu->timer);
+ mod_timer(&mpu->timer, 1 + jiffies);
spin_unlock_irqrestore(&mpu->timer_lock, flags);
if (mpu->rmidi) _snd_mpu401_uart_interrupt(mpu);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,183 |
--- initial
+++ final
@@ -1,10 +1,9 @@
static void snd_card_asihpi_pcm_timer_start(struct snd_pcm_substream *substream) {
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
int expiry;
expiry = HZ / 200;
expiry = max(expiry, 1); /* don't let it be zero! */
- dpcm->timer.expires = jiffies + expiry;
dpcm->respawn_timer = 1;
- add_timer(&dpcm->timer);
+ mod_timer(&dpcm->timer, jiffies + expiry);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,200 |
--- initial
+++ final
@@ -1,154 +1,151 @@
static int ena_probe(struct pci_dev *pdev, const struct pci_device_id *ent) {
struct ena_com_dev_get_features_ctx get_feat_ctx;
static int version_printed;
struct net_device *netdev;
struct ena_adapter *adapter;
struct ena_com_dev *ena_dev = NULL;
static int adapters_found;
int io_queue_num, bars, rc;
int queue_size;
u16 tx_sgl_size = 0;
u16 rx_sgl_size = 0;
bool wd_state;
dev_dbg(&pdev->dev, "%s\n", __func__);
if (version_printed++ == 0) dev_info(&pdev->dev, "%s", version);
rc = pci_enable_device_mem(pdev);
if (rc) {
dev_err(&pdev->dev, "pci_enable_device_mem() failed!\n");
return rc;
}
pci_set_master(pdev);
ena_dev = vzalloc(sizeof(*ena_dev));
if (!ena_dev) {
rc = -ENOMEM;
goto err_disable_device;
}
bars = pci_select_bars(pdev, IORESOURCE_MEM) & ENA_BAR_MASK;
rc = pci_request_selected_regions(pdev, bars, DRV_MODULE_NAME);
if (rc) {
dev_err(&pdev->dev, "pci_request_selected_regions failed %d\n", rc);
goto err_free_ena_dev;
}
ena_dev->reg_bar = ioremap(pci_resource_start(pdev, ENA_REG_BAR), pci_resource_len(pdev, ENA_REG_BAR));
if (!ena_dev->reg_bar) {
dev_err(&pdev->dev, "failed to remap regs bar\n");
rc = -EFAULT;
goto err_free_region;
}
ena_dev->dmadev = &pdev->dev;
rc = ena_device_init(ena_dev, pdev, &get_feat_ctx, &wd_state);
if (rc) {
dev_err(&pdev->dev, "ena device init failed\n");
if (rc == -ETIME) rc = -EPROBE_DEFER;
goto err_free_region;
}
ena_set_push_mode(pdev, ena_dev, &get_feat_ctx);
if (ena_dev->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
ena_dev->mem_bar = ioremap_wc(pci_resource_start(pdev, ENA_MEM_BAR), pci_resource_len(pdev, ENA_MEM_BAR));
if (!ena_dev->mem_bar) {
rc = -EFAULT;
goto err_device_destroy;
}
}
/* initial Tx interrupt delay, Assumes 1 usec granularity.
* Updated during device initialization with the real granularity
*/
ena_dev->intr_moder_tx_interval = ENA_INTR_INITIAL_TX_INTERVAL_USECS;
io_queue_num = ena_calc_io_queue_num(pdev, ena_dev, &get_feat_ctx);
queue_size = ena_calc_queue_size(pdev, ena_dev, &tx_sgl_size, &rx_sgl_size, &get_feat_ctx);
if ((queue_size <= 0) || (io_queue_num <= 0)) {
rc = -EFAULT;
goto err_device_destroy;
}
dev_info(&pdev->dev, "creating %d io queues. queue size: %d\n", io_queue_num, queue_size);
/* dev zeroed in init_etherdev */
netdev = alloc_etherdev_mq(sizeof(struct ena_adapter), io_queue_num);
if (!netdev) {
dev_err(&pdev->dev, "alloc_etherdev_mq failed\n");
rc = -ENOMEM;
goto err_device_destroy;
}
SET_NETDEV_DEV(netdev, &pdev->dev);
adapter = netdev_priv(netdev);
pci_set_drvdata(pdev, adapter);
adapter->ena_dev = ena_dev;
adapter->netdev = netdev;
adapter->pdev = pdev;
ena_set_conf_feat_params(adapter, &get_feat_ctx);
adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
adapter->tx_ring_size = queue_size;
adapter->rx_ring_size = queue_size;
adapter->max_tx_sgl_size = tx_sgl_size;
adapter->max_rx_sgl_size = rx_sgl_size;
adapter->num_queues = io_queue_num;
adapter->last_monitored_tx_qid = 0;
adapter->rx_copybreak = ENA_DEFAULT_RX_COPYBREAK;
adapter->wd_state = wd_state;
snprintf(adapter->name, ENA_NAME_MAX_LEN, "ena_%d", adapters_found);
rc = ena_com_init_interrupt_moderation(adapter->ena_dev);
if (rc) {
dev_err(&pdev->dev, "Failed to query interrupt moderation feature\n");
goto err_netdev_destroy;
}
ena_init_io_rings(adapter);
netdev->netdev_ops = &ena_netdev_ops;
netdev->watchdog_timeo = TX_TIMEOUT;
ena_set_ethtool_ops(netdev);
netdev->priv_flags |= IFF_UNICAST_FLT;
u64_stats_init(&adapter->syncp);
rc = ena_enable_msix_and_set_admin_interrupts(adapter, io_queue_num);
if (rc) {
dev_err(&pdev->dev, "Failed to enable and set the admin interrupts\n");
goto err_worker_destroy;
}
rc = ena_rss_init_default(adapter);
if (rc && (rc != -EPERM)) {
dev_err(&pdev->dev, "Cannot init RSS rc: %d\n", rc);
goto err_free_msix;
}
ena_config_debug_area(adapter);
memcpy(adapter->netdev->perm_addr, adapter->mac_addr, netdev->addr_len);
netif_carrier_off(netdev);
rc = register_netdev(netdev);
if (rc) {
dev_err(&pdev->dev, "Cannot register net device\n");
goto err_rss;
}
INIT_WORK(&adapter->suspend_io_task, ena_device_io_suspend);
INIT_WORK(&adapter->resume_io_task, ena_device_io_resume);
INIT_WORK(&adapter->reset_task, ena_fw_reset_device);
adapter->last_keep_alive_jiffies = jiffies;
- init_timer(&adapter->timer_service);
- adapter->timer_service.expires = round_jiffies(jiffies + HZ);
- adapter->timer_service.function = ena_timer_service;
- adapter->timer_service.data = (unsigned long)adapter;
- add_timer(&adapter->timer_service);
+ setup_timer(&adapter->timer_service, ena_timer_service, (unsigned long)adapter);
+ mod_timer(&adapter->timer_service, round_jiffies(jiffies + HZ));
dev_info(&pdev->dev, "%s found at mem %lx, mac addr %pM Queues %d\n", DEVICE_NAME, (long)pci_resource_start(pdev, 0), netdev->dev_addr, io_queue_num);
set_bit(ENA_FLAG_DEVICE_RUNNING, &adapter->flags);
adapters_found++;
return 0;
err_rss:
ena_com_delete_debug_area(ena_dev);
ena_com_rss_destroy(ena_dev);
err_free_msix:
ena_com_dev_reset(ena_dev);
ena_free_mgmnt_irq(adapter);
ena_disable_msix(adapter);
err_worker_destroy:
ena_com_destroy_interrupt_moderation(ena_dev);
del_timer(&adapter->timer_service);
cancel_work_sync(&adapter->suspend_io_task);
cancel_work_sync(&adapter->resume_io_task);
err_netdev_destroy:
free_netdev(netdev);
err_device_destroy:
ena_com_delete_host_info(ena_dev);
ena_com_admin_destroy(ena_dev);
err_free_region:
ena_release_bars(ena_dev, pdev);
err_free_ena_dev:
vfree(ena_dev);
err_disable_device:
pci_disable_device(pdev);
return rc;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,234 |
--- initial
+++ final
@@ -1,36 +1,33 @@
static int set_protocol_running(struct pcbit_dev *dev) {
isdn_ctrl ctl;
- init_timer(&dev->set_running_timer);
- dev->set_running_timer.function = &set_running_timeout;
- dev->set_running_timer.data = (ulong)dev;
- dev->set_running_timer.expires = jiffies + SET_RUN_TIMEOUT;
+ setup_timer(&dev->set_running_timer, &set_running_timeout, (ulong)dev);
/* kick it */
dev->l2_state = L2_STARTING;
writeb((0x80U | ((dev->rcv_seq & 0x07) << 3) | (dev->send_seq & 0x07)), dev->sh_mem + BANK4);
- add_timer(&dev->set_running_timer);
+ mod_timer(&dev->set_running_timer, jiffies + SET_RUN_TIMEOUT);
wait_event(dev->set_running_wq, dev->l2_state == L2_RUNNING || dev->l2_state == L2_DOWN);
del_timer(&dev->set_running_timer);
if (dev->l2_state == L2_RUNNING) {
printk(KERN_DEBUG "pcbit: running\n");
dev->unack_seq = dev->send_seq;
dev->writeptr = dev->sh_mem;
dev->readptr = dev->sh_mem + BANK2;
/* tell the good news to the upper layer */
ctl.driver = dev->id;
ctl.command = ISDN_STAT_RUN;
dev->dev_if->statcallb(&ctl);
} else {
printk(KERN_DEBUG "pcbit: initialization failed\n");
printk(KERN_DEBUG "pcbit: firmware not loaded\n");
#ifdef DEBUG
printk(KERN_DEBUG "Bank3 = %02x\n", readb(dev->sh_mem + BANK3));
#endif
writeb(0x40, dev->sh_mem + BANK4);
/* warn the upper layer */
ctl.driver = dev->id;
ctl.command = ISDN_STAT_STOP;
dev->dev_if->statcallb(&ctl);
return -EL2HLT; /* Level 2 halted */
}
return 0;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,227 |
--- initial
+++ final
@@ -1,67 +1,65 @@
static void media_check(unsigned long arg) {
struct net_device *dev = (struct net_device *)(arg);
struct el3_private *lp = netdev_priv(dev);
unsigned int ioaddr = dev->base_addr;
u16 media, errs;
unsigned long flags;
if (!netif_device_present(dev)) goto reschedule;
/* Check for pending interrupt with expired latency timer: with
* this, we can limp along even if the interrupt is blocked
*/
if ((inw(ioaddr + EL3_STATUS) & IntLatch) && (inb(ioaddr + EL3_TIMER) == 0xff)) {
if (!lp->fast_poll) netdev_warn(dev, "interrupt(s) dropped!\n");
local_irq_save(flags);
el3_interrupt(dev->irq, dev);
local_irq_restore(flags);
lp->fast_poll = HZ;
}
if (lp->fast_poll) {
lp->fast_poll--;
- lp->media.expires = jiffies + HZ / 100;
- add_timer(&lp->media);
+ mod_timer(&lp->media, jiffies + HZ / 100);
return;
}
/* lp->lock guards the EL3 window. Window should always be 1 except
* when the lock is held
*/
spin_lock_irqsave(&lp->lock, flags);
EL3WINDOW(4);
media = inw(ioaddr + WN4_MEDIA) & 0xc810;
/* Ignore collisions unless we've had no irq's recently */
if (time_before(jiffies, lp->last_irq + HZ)) {
media &= ~0x0010;
} else {
/* Try harder to detect carrier errors */
EL3WINDOW(6);
outw(StatsDisable, ioaddr + EL3_CMD);
errs = inb(ioaddr + 0);
outw(StatsEnable, ioaddr + EL3_CMD);
dev->stats.tx_carrier_errors += errs;
if (errs || (lp->media_status & 0x0010)) media |= 0x0010;
}
if (media != lp->media_status) {
if ((media & lp->media_status & 0x8000) && ((lp->media_status ^ media) & 0x0800))
netdev_info(dev, "%s link beat\n", (lp->media_status & 0x0800 ? "lost" : "found"));
else if ((media & lp->media_status & 0x4000) && ((lp->media_status ^ media) & 0x0010))
netdev_info(dev, "coax cable %s\n", (lp->media_status & 0x0010 ? "ok" : "problem"));
if (dev->if_port == 0) {
if (media & 0x8000) {
if (media & 0x0800)
netdev_info(dev, "flipped to 10baseT\n");
else
tc589_set_xcvr(dev, 2);
} else if (media & 0x4000) {
if (media & 0x0010)
tc589_set_xcvr(dev, 1);
else
netdev_info(dev, "flipped to 10base2\n");
}
}
lp->media_status = media;
}
EL3WINDOW(1);
spin_unlock_irqrestore(&lp->lock, flags);
reschedule:
- lp->media.expires = jiffies + HZ;
- add_timer(&lp->media);
+ mod_timer(&lp->media, jiffies + HZ);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,211 |
--- initial
+++ final
@@ -1,73 +1,71 @@
static void ei_watchdog(u_long arg) {
struct net_device *dev = (struct net_device *)arg;
struct pcnet_dev *info = PRIV(dev);
unsigned int nic_base = dev->base_addr;
unsigned int mii_addr = nic_base + DLINK_GPIO;
u_short link;
if (!netif_device_present(dev)) goto reschedule;
/* Check for pending interrupt with expired latency timer: with
this, we can limp along even if the interrupt is blocked */
if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) {
if (!info->fast_poll) netdev_info(dev, "interrupt(s) dropped!\n");
ei_irq_wrapper(dev->irq, dev);
info->fast_poll = HZ;
}
if (info->fast_poll) {
info->fast_poll--;
- info->watchdog.expires = jiffies + 1;
- add_timer(&info->watchdog);
+ mod_timer(&info->watchdog, jiffies + 1);
return;
}
if (!(info->flags & HAS_MII)) goto reschedule;
mdio_read(mii_addr, info->phy_id, 1);
link = mdio_read(mii_addr, info->phy_id, 1);
if (!link || (link == 0xffff)) {
if (info->eth_phy) {
info->phy_id = info->eth_phy = 0;
} else {
netdev_info(dev, "MII is missing!\n");
info->flags &= ~HAS_MII;
}
goto reschedule;
}
link &= 0x0004;
if (link != info->link_status) {
u_short p = mdio_read(mii_addr, info->phy_id, 5);
netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
if (link && (info->flags & IS_DL10022)) {
/* Disable collision detection on full duplex links */
outb((p & 0x0140) ? 4 : 0, nic_base + DLINK_DIAG);
} else if (link && (info->flags & IS_DL10019)) {
/* Disable collision detection on full duplex links */
write_asic(dev->base_addr, 4, (p & 0x140) ? DL19FDUPLX : 0);
}
if (link) {
if (info->phy_id == info->eth_phy) {
if (p)
netdev_info(dev,
"autonegotiation complete: "
"%sbaseT-%cD selected\n",
((p & 0x0180) ? "100" : "10"), ((p & 0x0140) ? 'F' : 'H'));
else
netdev_info(dev, "link partner did not autonegotiate\n");
}
NS8390_init(dev, 1);
}
info->link_status = link;
}
if (info->pna_phy && time_after(jiffies, info->mii_reset + 6 * HZ)) {
link = mdio_read(mii_addr, info->eth_phy, 1) & 0x0004;
if (((info->phy_id == info->pna_phy) && link) || ((info->phy_id != info->pna_phy) && !link)) {
/* isolate this MII and try flipping to the other one */
mdio_write(mii_addr, info->phy_id, 0, 0x0400);
info->phy_id ^= info->pna_phy ^ info->eth_phy;
netdev_info(dev, "switched to %s transceiver\n", (info->phy_id == info->eth_phy) ? "ethernet" : "PNA");
mdio_write(mii_addr, info->phy_id, 0, (info->phy_id == info->eth_phy) ? 0x1000 : 0);
info->link_status = 0;
info->mii_reset = jiffies;
}
}
reschedule:
- info->watchdog.expires = jiffies + HZ;
- add_timer(&info->watchdog);
+ mod_timer(&info->watchdog, jiffies + HZ);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,217 |
--- initial
+++ final
@@ -1,12 +1,9 @@
static void fbcon_add_cursor_timer(struct fb_info *info) {
struct fbcon_ops *ops = info->fbcon_par;
if ((!info->queue.func || info->queue.func == fb_flashcursor) && !(ops->flags & FBCON_FLAGS_CURSOR_TIMER) && !fbcon_cursor_noblink) {
if (!info->queue.func) INIT_WORK(&info->queue, fb_flashcursor);
- init_timer(&ops->cursor_timer);
- ops->cursor_timer.function = cursor_timer_handler;
- ops->cursor_timer.expires = jiffies + ops->cur_blink_jiffies;
- ops->cursor_timer.data = (unsigned long)info;
- add_timer(&ops->cursor_timer);
+ setup_timer(&ops->cursor_timer, cursor_timer_handler, (unsigned long)info);
+ mod_timer(&ops->cursor_timer, jiffies + ops->cur_blink_jiffies);
ops->flags |= FBCON_FLAGS_CURSOR_TIMER;
}
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,237 |
--- initial
+++ final
@@ -1,29 +1,28 @@
static void start_voice(struct snd_emu8k_pcm *rec, int ch) {
unsigned long flags;
struct snd_emu8000 *hw = rec->emu;
unsigned int temp, aux;
int pt = calc_pitch_target(rec->pitch);
/* cutoff and volume */
EMU8000_IFATN_WRITE(hw, ch, 0xff00);
EMU8000_VTFT_WRITE(hw, ch, 0xffff);
EMU8000_CVCF_WRITE(hw, ch, 0xffff);
/* trigger envelope */
EMU8000_DCYSUSV_WRITE(hw, ch, 0x7f7f);
/* set reverb and pitch target */
temp = 0; // reverb
if (rec->panning[ch] == 0)
aux = 0xff;
else
aux = (-rec->panning[ch]) & 0xff;
temp = (temp << 8) | (pt << 16) | aux;
EMU8000_PTRX_WRITE(hw, ch, temp);
EMU8000_CPF_WRITE(hw, ch, pt << 16);
/* start timer */
spin_lock_irqsave(&rec->timer_lock, flags);
if (!rec->timer_running) {
- rec->timer.expires = jiffies + 1;
- add_timer(&rec->timer);
+ mod_timer(&rec->timer, jiffies + 1);
rec->timer_running = 1;
}
spin_unlock_irqrestore(&rec->timer_lock, flags);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,194 |
--- initial
+++ final
@@ -1,6 +1,5 @@
static void yenta_interrupt_wrapper(unsigned long data) {
struct yenta_socket *socket = (struct yenta_socket *)data;
yenta_interrupt(0, (void *)socket);
- socket->poll_timer.expires = jiffies + HZ;
- add_timer(&socket->poll_timer);
+ mod_timer(&socket->poll_timer, jiffies + HZ);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,213 |
--- initial
+++ final
@@ -1,9 +1,6 @@
static void stmmac_init_tx_coalesce(struct stmmac_priv *priv) {
priv->tx_coal_frames = STMMAC_TX_FRAMES;
priv->tx_coal_timer = STMMAC_COAL_TX_TIMER;
- init_timer(&priv->txtimer);
- priv->txtimer.expires = STMMAC_COAL_TIMER(priv->tx_coal_timer);
- priv->txtimer.data = (unsigned long)priv;
- priv->txtimer.function = stmmac_tx_timer;
- add_timer(&priv->txtimer);
+ setup_timer(&priv->txtimer, stmmac_tx_timer, (unsigned long)priv);
+ mod_timer(&priv->txtimer, STMMAC_COAL_TIMER(priv->tx_coal_timer));
}<sep>@@
expression E0;
expression E1,e1;
expression E2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.function = e1;
- E0.data = E2;
... when != init_timer(&E0);
- E0.function = E1;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,222 |
--- initial
+++ final
@@ -1,83 +1,81 @@
static int bcm_enetsw_probe(struct platform_device *pdev) {
struct bcm_enet_priv *priv;
struct net_device *dev;
struct bcm63xx_enetsw_platform_data *pd;
struct resource *res_mem;
int ret, irq_rx, irq_tx;
/* stop if shared driver failed, assume driver->probe will be
* called in the same order we register devices (correct ?)
*/
if (!bcm_enet_shared_base[0]) return -ENODEV;
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq_rx = platform_get_irq(pdev, 0);
irq_tx = platform_get_irq(pdev, 1);
if (!res_mem || irq_rx < 0) return -ENODEV;
ret = 0;
dev = alloc_etherdev(sizeof(*priv));
if (!dev) return -ENOMEM;
priv = netdev_priv(dev);
memset(priv, 0, sizeof(*priv));
/* initialize default and fetch platform data */
priv->enet_is_sw = true;
priv->irq_rx = irq_rx;
priv->irq_tx = irq_tx;
priv->rx_ring_size = BCMENET_DEF_RX_DESC;
priv->tx_ring_size = BCMENET_DEF_TX_DESC;
priv->dma_maxburst = BCMENETSW_DMA_MAXBURST;
pd = dev_get_platdata(&pdev->dev);
if (pd) {
memcpy(dev->dev_addr, pd->mac_addr, ETH_ALEN);
memcpy(priv->used_ports, pd->used_ports, sizeof(pd->used_ports));
priv->num_ports = pd->num_ports;
priv->dma_has_sram = pd->dma_has_sram;
priv->dma_chan_en_mask = pd->dma_chan_en_mask;
priv->dma_chan_int_mask = pd->dma_chan_int_mask;
priv->dma_chan_width = pd->dma_chan_width;
}
ret = bcm_enet_change_mtu(dev, dev->mtu);
if (ret) goto out;
if (!request_mem_region(res_mem->start, resource_size(res_mem), "bcm63xx_enetsw")) {
ret = -EBUSY;
goto out;
}
priv->base = ioremap(res_mem->start, resource_size(res_mem));
if (priv->base == NULL) {
ret = -ENOMEM;
goto out_release_mem;
}
priv->mac_clk = clk_get(&pdev->dev, "enetsw");
if (IS_ERR(priv->mac_clk)) {
ret = PTR_ERR(priv->mac_clk);
goto out_unmap;
}
clk_enable(priv->mac_clk);
priv->rx_chan = 0;
priv->tx_chan = 1;
spin_lock_init(&priv->rx_lock);
/* init rx timeout (used for oom) */
- init_timer(&priv->rx_timeout);
- priv->rx_timeout.function = bcm_enet_refill_rx_timer;
- priv->rx_timeout.data = (unsigned long)dev;
+ setup_timer(&priv->rx_timeout, bcm_enet_refill_rx_timer, (unsigned long)dev);
/* register netdevice */
dev->netdev_ops = &bcm_enetsw_ops;
netif_napi_add(dev, &priv->napi, bcm_enet_poll, 16);
dev->ethtool_ops = &bcm_enetsw_ethtool_ops;
SET_NETDEV_DEV(dev, &pdev->dev);
spin_lock_init(&priv->enetsw_mdio_lock);
ret = register_netdev(dev);
if (ret) goto out_put_clk;
netif_carrier_off(dev);
platform_set_drvdata(pdev, dev);
priv->pdev = pdev;
priv->net_dev = dev;
return 0;
out_put_clk:
clk_put(priv->mac_clk);
out_unmap:
iounmap(priv->base);
out_release_mem:
release_mem_region(res_mem->start, resource_size(res_mem));
out:
free_netdev(dev);
return ret;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
<|end_of_text|> | 1,247 |
--- initial
+++ final
@@ -1,15 +1,14 @@
static void snd_mtpav_output_timer(unsigned long data) {
unsigned long flags;
struct mtpav *chip = (struct mtpav *)data;
int p;
spin_lock_irqsave(&chip->spinlock, flags);
/* reprogram timer */
- chip->timer.expires = 1 + jiffies;
- add_timer(&chip->timer);
+ mod_timer(&chip->timer, 1 + jiffies);
/* process each port */
for (p = 0; p <= chip->num_ports * 2 + MTPAV_PIDX_BROADCAST; p++) {
struct mtpav_port *portp = &chip->ports[p];
if ((portp->mode & MTPAV_MODE_OUTPUT_TRIGGERED) && portp->output) snd_mtpav_output_port_write(chip, portp, portp->output);
}
spin_unlock_irqrestore(&chip->spinlock, flags);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,185 |
--- initial
+++ final
@@ -1,51 +1,46 @@
int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2], unsigned char multicast_spec, u8 protocol_version) {
struct hsr_priv *hsr;
struct hsr_port *port;
int res;
hsr = netdev_priv(hsr_dev);
INIT_LIST_HEAD(&hsr->ports);
INIT_LIST_HEAD(&hsr->node_db);
INIT_LIST_HEAD(&hsr->self_node_db);
ether_addr_copy(hsr_dev->dev_addr, slave[0]->dev_addr);
/* Make sure we recognize frames from ourselves in hsr_rcv() */
res = hsr_create_self_node(&hsr->self_node_db, hsr_dev->dev_addr, slave[1]->dev_addr);
if (res < 0) return res;
spin_lock_init(&hsr->seqnr_lock);
/* Overflow soon to find bugs easier: */
hsr->sequence_nr = HSR_SEQNR_START;
hsr->sup_sequence_nr = HSR_SUP_SEQNR_START;
- init_timer(&hsr->announce_timer);
- hsr->announce_timer.function = hsr_announce;
- hsr->announce_timer.data = (unsigned long)hsr;
- init_timer(&hsr->prune_timer);
- hsr->prune_timer.function = hsr_prune_nodes;
- hsr->prune_timer.data = (unsigned long)hsr;
+ setup_timer(&hsr->announce_timer, hsr_announce, (unsigned long)hsr);
+ setup_timer(&hsr->prune_timer, hsr_prune_nodes, (unsigned long)hsr);
ether_addr_copy(hsr->sup_multicast_addr, def_multicast_addr);
hsr->sup_multicast_addr[ETH_ALEN - 1] = multicast_spec;
hsr->protVersion = protocol_version;
/* FIXME: should I modify the value of these?
*
* - hsr_dev->flags - i.e.
* IFF_MASTER/SLAVE?
* - hsr_dev->priv_flags - i.e.
* IFF_EBRIDGE?
* IFF_TX_SKB_SHARING?
* IFF_HSR_MASTER/SLAVE?
*/
/* Make sure the 1st call to netif_carrier_on() gets through */
netif_carrier_off(hsr_dev);
res = hsr_add_port(hsr, hsr_dev, HSR_PT_MASTER);
if (res) return res;
res = register_netdevice(hsr_dev);
if (res) goto fail;
res = hsr_add_port(hsr, slave[0], HSR_PT_SLAVE_A);
if (res) goto fail;
res = hsr_add_port(hsr, slave[1], HSR_PT_SLAVE_B);
if (res) goto fail;
- hsr->prune_timer.expires = jiffies + msecs_to_jiffies(PRUNE_PERIOD);
- add_timer(&hsr->prune_timer);
+ mod_timer(&hsr->prune_timer, jiffies + msecs_to_jiffies(PRUNE_PERIOD));
return 0;
fail:
hsr_for_each_port(hsr, port) hsr_del_port(port);
return res;
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,233 |
--- initial
+++ final
@@ -1,45 +1,43 @@
static void ei_watchdog(u_long arg) {
struct net_device *dev = (struct net_device *)(arg);
struct axnet_dev *info = PRIV(dev);
unsigned int nic_base = dev->base_addr;
unsigned int mii_addr = nic_base + AXNET_MII_EEP;
u_short link;
if (!netif_device_present(dev)) goto reschedule;
/* Check for pending interrupt with expired latency timer: with
this, we can limp along even if the interrupt is blocked */
if (info->stale++ && (inb_p(nic_base + EN0_ISR) & ENISR_ALL)) {
if (!info->fast_poll) netdev_info(dev, "interrupt(s) dropped!\n");
ei_irq_wrapper(dev->irq, dev);
info->fast_poll = HZ;
}
if (info->fast_poll) {
info->fast_poll--;
- info->watchdog.expires = jiffies + 1;
- add_timer(&info->watchdog);
+ mod_timer(&info->watchdog, jiffies + 1);
return;
}
if (info->phy_id < 0) goto reschedule;
link = mdio_read(mii_addr, info->phy_id, 1);
if (!link || (link == 0xffff)) {
netdev_info(dev, "MII is missing!\n");
info->phy_id = -1;
goto reschedule;
}
link &= 0x0004;
if (link != info->link_status) {
u_short p = mdio_read(mii_addr, info->phy_id, 5);
netdev_info(dev, "%s link beat\n", link ? "found" : "lost");
if (link) {
info->duplex_flag = (p & 0x0140) ? 0x80 : 0x00;
if (p)
netdev_info(dev, "autonegotiation complete: %dbaseT-%cD selected\n", (p & 0x0180) ? 100 : 10, (p & 0x0140) ? 'F' : 'H');
else
netdev_info(dev, "link partner did not autonegotiate\n");
AX88190_init(dev, 1);
}
info->link_status = link;
}
reschedule:
- info->watchdog.expires = jiffies + HZ;
- add_timer(&info->watchdog);
+ mod_timer(&info->watchdog, jiffies + HZ);
}<sep>@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,220 |
--- initial
+++ final
@@ -1,20 +1,17 @@
static void snd_hdspm_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) {
struct hdspm_midi *hmidi;
unsigned long flags;
hmidi = substream->rmidi->private_data;
spin_lock_irqsave(&hmidi->lock, flags);
if (up) {
if (!hmidi->istimer) {
- init_timer(&hmidi->timer);
- hmidi->timer.function = snd_hdspm_midi_output_timer;
- hmidi->timer.data = (unsigned long)hmidi;
- hmidi->timer.expires = 1 + jiffies;
- add_timer(&hmidi->timer);
+ setup_timer(&hmidi->timer, snd_hdspm_midi_output_timer, (unsigned long)hmidi);
+ mod_timer(&hmidi->timer, 1 + jiffies);
hmidi->istimer++;
}
} else {
if (hmidi->istimer && --hmidi->istimer <= 0) del_timer(&hmidi->timer);
}
spin_unlock_irqrestore(&hmidi->lock, flags);
if (up) snd_hdspm_midi_output_write(hmidi);
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,208 |
--- initial
+++ final
@@ -1,91 +1,85 @@
static int icn_loadproto(u_char __user *buffer, icn_card *card) {
register u_char __user *p = buffer;
u_char codebuf[256];
uint left = ICN_CODE_STAGE2;
uint cnt;
int timer;
unsigned long flags;
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadproto called\n");
#endif
if (!access_ok(VERIFY_READ, buffer, ICN_CODE_STAGE2)) return -EFAULT;
timer = 0;
spin_lock_irqsave(&dev.devlock, flags);
if (card->secondhalf) {
icn_map_channel(card, 2);
icn_lock_channel(card, 2);
} else {
icn_map_channel(card, 0);
icn_lock_channel(card, 0);
}
spin_unlock_irqrestore(&dev.devlock, flags);
while (left) {
if (sbfree) { /* If there is a free buffer... */
cnt = left;
if (cnt > 256) cnt = 256;
if (copy_from_user(codebuf, p, cnt)) {
icn_maprelease_channel(card, 0);
return -EFAULT;
}
memcpy_toio(&sbuf_l, codebuf, cnt); /* copy data */
sbnext; /* switch to next buffer */
p += cnt;
left -= cnt;
timer = 0;
} else {
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "boot 2 !sbfree\n");
#endif
if (timer++ > 5) {
icn_maprelease_channel(card, 0);
return -EIO;
}
schedule_timeout_interruptible(10);
}
}
writeb(0x20, &sbuf_n);
timer = 0;
while (1) {
if (readb(&cmd_o) || readb(&cmd_i)) {
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "Proto?\n");
#endif
if (timer++ > 5) {
printk(KERN_WARNING "icn: (%s) Protocol timed out.\n", CID);
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "Proto TO!\n");
#endif
icn_maprelease_channel(card, 0);
return -EIO;
}
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "Proto TO?\n");
#endif
msleep_interruptible(ICN_BOOT_TIMEOUT1);
} else {
if ((card->secondhalf) || (!card->doubleS0)) {
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "Proto loaded, install poll-timer %d\n", card->secondhalf);
#endif
spin_lock_irqsave(&card->lock, flags);
- init_timer(&card->st_timer);
- card->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
- card->st_timer.function = icn_polldchan;
- card->st_timer.data = (unsigned long)card;
- add_timer(&card->st_timer);
+ setup_timer(&card->st_timer, icn_polldchan, (unsigned long)card);
+ mod_timer(&card->st_timer, jiffies + ICN_TIMER_DCREAD);
card->flags |= ICN_FLAGS_RUNNING;
if (card->doubleS0) {
- init_timer(&card->other->st_timer);
- card->other->st_timer.expires = jiffies + ICN_TIMER_DCREAD;
- card->other->st_timer.function = icn_polldchan;
- card->other->st_timer.data = (unsigned long)card->other;
- add_timer(&card->other->st_timer);
+ setup_timer(&card->other->st_timer, icn_polldchan, (unsigned long)card->other);
+ mod_timer(&card->other->st_timer, jiffies + ICN_TIMER_DCREAD);
card->other->flags |= ICN_FLAGS_RUNNING;
}
spin_unlock_irqrestore(&card->lock, flags);
}
icn_maprelease_channel(card, 0);
return 0;
}
}
}<sep>@@
expression E0;
expression E1;
expression E2,e2;
@@
- init_timer(&E0);
+ setup_timer(&E0, E1, E2);
... when != E0.data = e2;
- E0.function = E1;
... when != init_timer(&E0);
- E0.data = E2;
@@
expression E0,v;
@@
- E0.expires = v;
...
- add_timer(&E0);
+ mod_timer(&E0, v);
<|end_of_text|> | 1,224 |
--- initial
+++ final
@@ -1,17 +1,17 @@
void afs_send_empty_reply(struct afs_call *call) {
struct afs_net *net = call->net;
struct msghdr msg;
_enter("");
rxrpc_kernel_set_tx_length(net->socket, call->rxcall, 0);
msg.msg_name = NULL;
msg.msg_namelen = 0;
- iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, NULL, 0, 0);
+ iov_iter_kvec(&msg.msg_iter, WRITE, NULL, 0, 0);
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
switch (rxrpc_kernel_send_data(net->socket, call->rxcall, &msg, 0, afs_notify_end_reply_tx)) {
case 0: _leave(" [replied]"); return;
case -ENOMEM: _debug("oom"); rxrpc_kernel_abort_call(net->socket, call->rxcall, RX_USER_ABORT, -ENOMEM, "KOO");
default: _leave(" [error]"); return;
}
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,156 |
--- initial
+++ final
@@ -1,90 +1,90 @@
static int l1oip_socket_thread(void *data) {
struct l1oip *hc = (struct l1oip *)data;
int ret = 0;
struct sockaddr_in sin_rx;
struct kvec iov;
struct msghdr msg = {.msg_name = &sin_rx, .msg_namelen = sizeof(sin_rx)};
unsigned char *recvbuf;
size_t recvbuf_size = 1500;
int recvlen;
struct socket *socket = NULL;
DECLARE_COMPLETION_ONSTACK(wait);
/* allocate buffer memory */
recvbuf = kmalloc(recvbuf_size, GFP_KERNEL);
if (!recvbuf) {
printk(KERN_ERR "%s: Failed to alloc recvbuf.\n", __func__);
ret = -ENOMEM;
goto fail;
}
iov.iov_base = recvbuf;
iov.iov_len = recvbuf_size;
/* make daemon */
allow_signal(SIGTERM);
/* create socket */
if (sock_create(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &socket)) {
printk(KERN_ERR "%s: Failed to create socket.\n", __func__);
ret = -EIO;
goto fail;
}
/* set incoming address */
hc->sin_local.sin_family = AF_INET;
hc->sin_local.sin_addr.s_addr = INADDR_ANY;
hc->sin_local.sin_port = htons((unsigned short)hc->localport);
/* set outgoing address */
hc->sin_remote.sin_family = AF_INET;
hc->sin_remote.sin_addr.s_addr = htonl(hc->remoteip);
hc->sin_remote.sin_port = htons((unsigned short)hc->remoteport);
/* bind to incoming port */
if (socket->ops->bind(socket, (struct sockaddr *)&hc->sin_local, sizeof(hc->sin_local))) {
printk(KERN_ERR "%s: Failed to bind socket to port %d.\n", __func__, hc->localport);
ret = -EINVAL;
goto fail;
}
/* check sk */
if (socket->sk == NULL) {
printk(KERN_ERR "%s: socket->sk == NULL\n", __func__);
ret = -EIO;
goto fail;
}
/* build send message */
hc->sendmsg.msg_name = &hc->sin_remote;
hc->sendmsg.msg_namelen = sizeof(hc->sin_remote);
hc->sendmsg.msg_control = NULL;
hc->sendmsg.msg_controllen = 0;
/* give away socket */
spin_lock(&hc->socket_lock);
hc->socket = socket;
spin_unlock(&hc->socket_lock);
/* read loop */
if (debug & DEBUG_L1OIP_SOCKET) printk(KERN_DEBUG "%s: socket created and open\n", __func__);
while (!signal_pending(current)) {
- iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, recvbuf_size);
+ iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, recvbuf_size);
recvlen = sock_recvmsg(socket, &msg, 0);
if (recvlen > 0) {
l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen);
} else {
if (debug & DEBUG_L1OIP_SOCKET) printk(KERN_WARNING "%s: broken pipe on socket\n", __func__);
}
}
/* get socket back, check first if in use, maybe by send function */
spin_lock(&hc->socket_lock);
/* if hc->socket is NULL, it is in use until it is given back */
while (!hc->socket) {
spin_unlock(&hc->socket_lock);
schedule_timeout(HZ / 10);
spin_lock(&hc->socket_lock);
}
hc->socket = NULL;
spin_unlock(&hc->socket_lock);
if (debug & DEBUG_L1OIP_SOCKET) printk(KERN_DEBUG "%s: socket thread terminating\n", __func__);
fail:
/* free recvbuf */
kfree(recvbuf);
/* close socket */
if (socket) sock_release(socket);
/* if we got killed, signal completion */
complete(&hc->socket_complete);
hc->socket_thread = NULL; /* show termination of thread */
if (debug & DEBUG_L1OIP_SOCKET) printk(KERN_DEBUG "%s: socket thread terminated\n", __func__);
return ret;
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,136 |
--- initial
+++ final
@@ -1,6 +1,6 @@
int cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page, unsigned int page_offset, unsigned int to_read) {
struct msghdr smb_msg;
struct bio_vec bv = {.bv_page = page, .bv_len = to_read, .bv_offset = page_offset};
- iov_iter_bvec(&smb_msg.msg_iter, READ | ITER_BVEC, &bv, 1, to_read);
+ iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read);
return cifs_readv_from_socket(server, &smb_msg);
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_bvec(e1,
- ITER_BVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,124 |
--- initial
+++ final
@@ -1,35 +1,35 @@
static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo) {
struct device *dev = &sbefifo->fsi_dev->dev;
struct iov_iter ffdc_iter;
struct kvec ffdc_iov;
__be32 *ffdc;
size_t ffdc_sz;
__be32 cmd[2];
int rc;
sbefifo->async_ffdc = false;
ffdc = vmalloc(SBEFIFO_MAX_FFDC_SIZE);
if (!ffdc) {
dev_err(dev, "Failed to allocate SBE FFDC buffer\n");
return;
}
ffdc_iov.iov_base = ffdc;
ffdc_iov.iov_len = SBEFIFO_MAX_FFDC_SIZE;
- iov_iter_kvec(&ffdc_iter, WRITE | ITER_KVEC, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE);
+ iov_iter_kvec(&ffdc_iter, WRITE, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE);
cmd[0] = cpu_to_be32(2);
cmd[1] = cpu_to_be32(SBEFIFO_CMD_GET_SBE_FFDC);
rc = sbefifo_do_command(sbefifo, cmd, 2, &ffdc_iter);
if (rc != 0) {
dev_err(dev, "Error %d retrieving SBE FFDC\n", rc);
goto bail;
}
ffdc_sz = SBEFIFO_MAX_FFDC_SIZE - iov_iter_count(&ffdc_iter);
ffdc_sz /= sizeof(__be32);
rc = sbefifo_parse_status(dev, SBEFIFO_CMD_GET_SBE_FFDC, ffdc, ffdc_sz, &ffdc_sz);
if (rc != 0) {
dev_err(dev, "Error %d decoding SBE FFDC\n", rc);
goto bail;
}
if (ffdc_sz > 0) sbefifo_dump_ffdc(dev, ffdc, ffdc_sz, true);
bail:
vfree(ffdc);
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,129 |
--- initial
+++ final
@@ -1,24 +1,24 @@
ssize_t generic_file_splice_read(struct file *in, loff_t *ppos, struct pipe_inode_info *pipe, size_t len, unsigned int flags) {
struct iov_iter to;
struct kiocb kiocb;
int idx, ret;
- iov_iter_pipe(&to, ITER_PIPE | READ, pipe, len);
+ iov_iter_pipe(&to, READ, pipe, len);
idx = to.idx;
init_sync_kiocb(&kiocb, in);
kiocb.ki_pos = *ppos;
ret = call_read_iter(in, &kiocb, &to);
if (ret > 0) {
*ppos = kiocb.ki_pos;
file_accessed(in);
} else if (ret < 0) {
to.idx = idx;
to.iov_offset = 0;
iov_iter_advance(&to, 0); /* to free what was emitted */
/*
* callers of ->splice_read() expect -EAGAIN on
* "can't put anything in there", rather than -EFAULT.
*/
if (ret == -EFAULT) ret = -EAGAIN;
}
return ret;
}<sep>@@
expression e1,e2,e3,e;
@@
iov_iter_pipe(e1,
- ITER_PIPE | e
+ e
, e2,e3)
<|end_of_text|> | 12,165 |
--- initial
+++ final
@@ -1,19 +1,19 @@
static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data) {
struct l2cap_chan *chan = conn->smp;
struct smp_chan *smp;
struct kvec iv[2];
struct msghdr msg;
if (!chan) return;
BT_DBG("code 0x%2.2x", code);
iv[0].iov_base = &code;
iv[0].iov_len = 1;
iv[1].iov_base = data;
iv[1].iov_len = len;
memset(&msg, 0, sizeof(msg));
- iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, iv, 2, 1 + len);
+ iov_iter_kvec(&msg.msg_iter, WRITE, iv, 2, 1 + len);
l2cap_chan_send(chan, &msg, 1 + len);
if (!chan->data) return;
smp = chan->data;
cancel_delayed_work_sync(&smp->security_timer);
schedule_delayed_work(&smp->security_timer, SMP_TIMEOUT);
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,160 |
--- initial
+++ final
@@ -1,39 +1,39 @@
__be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int stable) {
struct svc_export *exp;
struct iov_iter iter;
__be32 nfserr;
int host_err;
int use_wgather;
loff_t pos = offset;
unsigned int pflags = current->flags;
rwf_t flags = 0;
trace_nfsd_write_opened(rqstp, fhp, offset, *cnt);
if (test_bit(RQ_LOCAL, &rqstp->rq_flags))
/*
* We want less throttling in balance_dirty_pages()
* and shrink_inactive_list() so that nfs to
* localhost doesn't cause nfsd to lock up due to all
* the client's dirty pages or its congested queue.
*/
current->flags |= PF_LESS_THROTTLE;
exp = fhp->fh_export;
use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp);
if (!EX_ISSYNC(exp)) stable = NFS_UNSTABLE;
if (stable && !use_wgather) flags |= RWF_SYNC;
- iov_iter_kvec(&iter, WRITE | ITER_KVEC, vec, vlen, *cnt);
+ iov_iter_kvec(&iter, WRITE, vec, vlen, *cnt);
host_err = vfs_iter_write(file, &iter, &pos, flags);
if (host_err < 0) goto out_nfserr;
nfsdstats.io_write += *cnt;
fsnotify_modify(file);
if (stable && use_wgather) host_err = wait_for_concurrent_writes(file);
out_nfserr:
if (host_err >= 0) {
trace_nfsd_write_io_done(rqstp, fhp, offset, *cnt);
nfserr = nfs_ok;
} else {
trace_nfsd_write_err(rqstp, fhp, offset, host_err);
nfserr = nfserrno(host_err);
}
if (test_bit(RQ_LOCAL, &rqstp->rq_flags)) current_restore_flags(pflags, PF_LESS_THROTTLE);
return nfserr;
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,181 |
--- initial
+++ final
@@ -1,38 +1,38 @@
int drbd_send(struct drbd_connection *connection, struct socket *sock, void *buf, size_t size, unsigned msg_flags) {
struct kvec iov = {.iov_base = buf, .iov_len = size};
struct msghdr msg = {.msg_flags = msg_flags | MSG_NOSIGNAL};
int rv, sent = 0;
if (!sock) return -EBADR;
/* THINK if (signal_pending) return ... ? */
- iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, &iov, 1, size);
+ iov_iter_kvec(&msg.msg_iter, WRITE, &iov, 1, size);
if (sock == connection->data.socket) {
rcu_read_lock();
connection->ko_count = rcu_dereference(connection->net_conf)->ko_count;
rcu_read_unlock();
drbd_update_congested(connection);
}
do {
rv = sock_sendmsg(sock, &msg);
if (rv == -EAGAIN) {
if (we_should_drop_the_connection(connection, sock))
break;
else
continue;
}
if (rv == -EINTR) {
flush_signals(current);
rv = 0;
}
if (rv < 0) break;
sent += rv;
} while (sent < size);
if (sock == connection->data.socket) clear_bit(NET_CONGESTED, &connection->flags);
if (rv <= 0) {
if (rv != -EAGAIN) {
drbd_err(connection, "%s_sendmsg returned %d\n", sock == connection->meta.socket ? "msock" : "sock", rv);
conn_request_state(connection, NS(conn, C_BROKEN_PIPE), CS_HARD);
} else
conn_request_state(connection, NS(conn, C_TIMEOUT), CS_HARD);
}
return sent;
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,125 |
--- initial
+++ final
@@ -1,14 +1,14 @@
ssize_t vmci_qpair_peek(struct vmci_qp *qpair, void *buf, size_t buf_size, int buf_type) {
struct iov_iter to;
struct kvec v = {.iov_base = buf, .iov_len = buf_size};
ssize_t result;
if (!qpair || !buf) return VMCI_ERROR_INVALID_ARGS;
- iov_iter_kvec(&to, READ | ITER_KVEC, &v, 1, buf_size);
+ iov_iter_kvec(&to, READ, &v, 1, buf_size);
qp_lock(qpair);
do {
result = qp_dequeue_locked(qpair->produce_q, qpair->consume_q, qpair->consume_q_size, &to, false);
if (result == VMCI_ERROR_QUEUEPAIR_NOT_READY && !qp_wait_for_ready_queue(qpair)) result = VMCI_ERROR_WOULD_BLOCK;
} while (result == VMCI_ERROR_QUEUEPAIR_NOT_READY);
qp_unlock(qpair);
return result;
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_kvec(e1,
- ITER_KVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,184 |
--- initial
+++ final
@@ -1,22 +1,22 @@
static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos, unsigned long nr_segs, size_t count) {
struct kiocb *iocb = &req->f.iocb;
ssize_t (*call_iter)(struct kiocb * iocb, struct iov_iter * iter);
struct iov_iter iter;
int ki_flags = 0, rw;
ssize_t ret;
if (req->cmd->rw.opcode == nvme_cmd_write) {
if (req->cmd->rw.control & cpu_to_le16(NVME_RW_FUA)) ki_flags = IOCB_DSYNC;
call_iter = req->ns->file->f_op->write_iter;
rw = WRITE;
} else {
call_iter = req->ns->file->f_op->read_iter;
rw = READ;
}
- iov_iter_bvec(&iter, ITER_BVEC | rw, req->f.bvec, nr_segs, count);
+ iov_iter_bvec(&iter, rw, req->f.bvec, nr_segs, count);
iocb->ki_pos = pos;
iocb->ki_filp = req->ns->file;
iocb->ki_flags = ki_flags | iocb_flags(req->ns->file);
ret = call_iter(iocb, &iter);
if (ret != -EIOCBQUEUED && iocb->ki_complete) iocb->ki_complete(iocb, ret, 0);
return ret;
}<sep>@@
expression e1,e2,e3,e4,e;
@@
iov_iter_bvec(e1,
- ITER_BVEC | e
+ e
, e2,e3,e4)
<|end_of_text|> | 12,132 |
Subsets and Splits