Char/misc driver fixes for 5.13-rc3

Here is a big set of char/misc/other driver fixes for 5.13-rc3.
 
 The majority here is the fallout of the umn.edu re-review of all prior
 submissions.  That resulted in a bunch of reverts along with the
 "correct" changes made, such that there is no regression of any of the
 potential fixes that were made by those individuals.  I would like to
 thank the over 80 different developers who helped with the review and
 fixes for this mess.
 
 Other than that, there's a few habanna driver fixes for reported issues,
 and some dyndbg fixes for reported problems.
 
 All of these have been in linux-next for a while with no reported
 problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYKZCBg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ynhRQCdGk6ri4oluyn/Z/2KAjvXDOmTmvgAn12VP42d
 S1Zmh4qRH2OWaLOBg7c2
 =qtxj
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here is a big set of char/misc/other driver fixes for 5.13-rc3.

  The majority here is the fallout of the umn.edu re-review of all prior
  submissions. That resulted in a bunch of reverts along with the
  "correct" changes made, such that there is no regression of any of the
  potential fixes that were made by those individuals. I would like to
  thank the over 80 different developers who helped with the review and
  fixes for this mess.

  Other than that, there's a few habanna driver fixes for reported
  issues, and some dyndbg fixes for reported problems.

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'char-misc-5.13-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (82 commits)
  misc: eeprom: at24: check suspend status before disable regulator
  uio_hv_generic: Fix another memory leak in error handling paths
  uio_hv_generic: Fix a memory leak in error handling paths
  uio/uio_pci_generic: fix return value changed in refactoring
  Revert "Revert "ALSA: usx2y: Fix potential NULL pointer dereference""
  dyndbg: drop uninformative vpr_info
  dyndbg: avoid calling dyndbg_emit_prefix when it has no work
  binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION
  cdrom: gdrom: initialize global variable at init time
  brcmfmac: properly check for bus register errors
  Revert "brcmfmac: add a check for the status of usb_register"
  video: imsttfb: check for ioremap() failures
  Revert "video: imsttfb: fix potential NULL pointer dereferences"
  net: liquidio: Add missing null pointer checks
  Revert "net: liquidio: fix a NULL pointer dereference"
  media: gspca: properly check for errors in po1030_probe()
  Revert "media: gspca: Check the return value of write_bridge for timeout"
  media: gspca: mt9m111: Check write_bridge for timeout
  Revert "media: gspca: mt9m111: Check write_bridge for timeout"
  media: dvb: Add check on sp8870_readreg return
  ...
This commit is contained in:
Linus Torvalds 2021-05-20 06:31:52 -10:00
commit 50f09a3dd5
59 changed files with 503 additions and 421 deletions

View File

@ -4918,7 +4918,7 @@ static long binder_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
uint32_t enable; uint32_t enable;
if (copy_from_user(&enable, ubuf, sizeof(enable))) { if (copy_from_user(&enable, ubuf, sizeof(enable))) {
ret = -EINVAL; ret = -EFAULT;
goto err; goto err;
} }
binder_inner_proc_lock(proc); binder_inner_proc_lock(proc);

View File

@ -744,6 +744,13 @@ static const struct blk_mq_ops gdrom_mq_ops = {
static int probe_gdrom(struct platform_device *devptr) static int probe_gdrom(struct platform_device *devptr)
{ {
int err; int err;
/*
* Ensure our "one" device is initialized properly in case of previous
* usages of it
*/
memset(&gd, 0, sizeof(gd));
/* Start the device */ /* Start the device */
if (gdrom_execute_diagnostic() != 1) { if (gdrom_execute_diagnostic() != 1) {
pr_warn("ATA Probe for GDROM failed\n"); pr_warn("ATA Probe for GDROM failed\n");
@ -830,6 +837,8 @@ static int remove_gdrom(struct platform_device *devptr)
if (gdrom_major) if (gdrom_major)
unregister_blkdev(gdrom_major, GDROM_DEV_NAME); unregister_blkdev(gdrom_major, GDROM_DEV_NAME);
unregister_cdrom(gd.cd_info); unregister_cdrom(gd.cd_info);
kfree(gd.cd_info);
kfree(gd.toc);
return 0; return 0;
} }
@ -845,7 +854,7 @@ static struct platform_driver gdrom_driver = {
static int __init init_gdrom(void) static int __init init_gdrom(void)
{ {
int rc; int rc;
gd.toc = NULL;
rc = platform_driver_register(&gdrom_driver); rc = platform_driver_register(&gdrom_driver);
if (rc) if (rc)
return rc; return rc;
@ -861,8 +870,6 @@ static void __exit exit_gdrom(void)
{ {
platform_device_unregister(pd); platform_device_unregister(pd);
platform_driver_unregister(&gdrom_driver); platform_driver_unregister(&gdrom_driver);
kfree(gd.toc);
kfree(gd.cd_info);
} }
module_init(init_gdrom); module_init(init_gdrom);

View File

@ -984,6 +984,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
hdp->hd_phys_address = fixmem32->address; hdp->hd_phys_address = fixmem32->address;
hdp->hd_address = ioremap(fixmem32->address, hdp->hd_address = ioremap(fixmem32->address,
HPET_RANGE_SIZE); HPET_RANGE_SIZE);
if (!hdp->hd_address)
return AE_ERROR;
if (hpet_is_known(hdp)) { if (hpet_is_known(hdp)) {
iounmap(hdp->hd_address); iounmap(hdp->hd_address);

View File

@ -442,7 +442,6 @@ static int nitrox_probe(struct pci_dev *pdev,
err = pci_request_mem_regions(pdev, nitrox_driver_name); err = pci_request_mem_regions(pdev, nitrox_driver_name);
if (err) { if (err) {
pci_disable_device(pdev); pci_disable_device(pdev);
dev_err(&pdev->dev, "Failed to request mem regions!\n");
return err; return err;
} }
pci_set_master(pdev); pci_set_master(pdev);

View File

@ -418,8 +418,23 @@ static int __init hidma_mgmt_init(void)
hidma_mgmt_of_populate_channels(child); hidma_mgmt_of_populate_channels(child);
} }
#endif #endif
return platform_driver_register(&hidma_mgmt_driver); /*
* We do not check for return value here, as it is assumed that
* platform_driver_register must not fail. The reason for this is that
* the (potential) hidma_mgmt_of_populate_channels calls above are not
* cleaned up if it does fail, and to do this work is quite
* complicated. In particular, various calls of of_address_to_resource,
* of_irq_to_resource, platform_device_register_full, of_dma_configure,
* and of_msi_configure which then call other functions and so on, must
* be cleaned up - this is not a trivial exercise.
*
* Currently, this module is not intended to be unloaded, and there is
* no module_exit function defined which does the needed cleanup. For
* this reason, we have to assume success here.
*/
platform_driver_register(&hidma_mgmt_driver);
return 0;
} }
module_init(hidma_mgmt_init); module_init(hidma_mgmt_init);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");

View File

@ -596,7 +596,6 @@ static int lm80_probe(struct i2c_client *client)
struct device *dev = &client->dev; struct device *dev = &client->dev;
struct device *hwmon_dev; struct device *hwmon_dev;
struct lm80_data *data; struct lm80_data *data;
int rv;
data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
if (!data) if (!data)
@ -609,14 +608,8 @@ static int lm80_probe(struct i2c_client *client)
lm80_init_client(client); lm80_init_client(client);
/* A few vars need to be filled upon startup */ /* A few vars need to be filled upon startup */
rv = lm80_read_value(client, LM80_REG_FAN_MIN(1)); data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
if (rv < 0) data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
return rv;
data->fan[f_min][0] = rv;
rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
if (rv < 0)
return rv;
data->fan[f_min][1] = rv;
hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
data, lm80_groups); data, lm80_groups);

View File

@ -46,7 +46,7 @@ static void hfcsusb_start_endpoint(struct hfcsusb *hw, int channel);
static void hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel); static void hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel);
static int hfcsusb_setup_bch(struct bchannel *bch, int protocol); static int hfcsusb_setup_bch(struct bchannel *bch, int protocol);
static void deactivate_bchannel(struct bchannel *bch); static void deactivate_bchannel(struct bchannel *bch);
static void hfcsusb_ph_info(struct hfcsusb *hw); static int hfcsusb_ph_info(struct hfcsusb *hw);
/* start next background transfer for control channel */ /* start next background transfer for control channel */
static void static void
@ -241,7 +241,7 @@ hfcusb_l2l1B(struct mISDNchannel *ch, struct sk_buff *skb)
* send full D/B channel status information * send full D/B channel status information
* as MPH_INFORMATION_IND * as MPH_INFORMATION_IND
*/ */
static void static int
hfcsusb_ph_info(struct hfcsusb *hw) hfcsusb_ph_info(struct hfcsusb *hw)
{ {
struct ph_info *phi; struct ph_info *phi;
@ -250,7 +250,7 @@ hfcsusb_ph_info(struct hfcsusb *hw)
phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC); phi = kzalloc(struct_size(phi, bch, dch->dev.nrbchan), GFP_ATOMIC);
if (!phi) if (!phi)
return; return -ENOMEM;
phi->dch.ch.protocol = hw->protocol; phi->dch.ch.protocol = hw->protocol;
phi->dch.ch.Flags = dch->Flags; phi->dch.ch.Flags = dch->Flags;
@ -263,6 +263,8 @@ hfcsusb_ph_info(struct hfcsusb *hw)
_queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY, _queue_data(&dch->dev.D, MPH_INFORMATION_IND, MISDN_ID_ANY,
struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC); struct_size(phi, bch, dch->dev.nrbchan), phi, GFP_ATOMIC);
kfree(phi); kfree(phi);
return 0;
} }
/* /*
@ -347,8 +349,7 @@ hfcusb_l2l1D(struct mISDNchannel *ch, struct sk_buff *skb)
ret = l1_event(dch->l1, hh->prim); ret = l1_event(dch->l1, hh->prim);
break; break;
case MPH_INFORMATION_REQ: case MPH_INFORMATION_REQ:
hfcsusb_ph_info(hw); ret = hfcsusb_ph_info(hw);
ret = 0;
break; break;
} }
@ -403,8 +404,7 @@ hfc_l1callback(struct dchannel *dch, u_int cmd)
hw->name, __func__, cmd); hw->name, __func__, cmd);
return -1; return -1;
} }
hfcsusb_ph_info(hw); return hfcsusb_ph_info(hw);
return 0;
} }
static int static int
@ -746,8 +746,7 @@ hfcsusb_setup_bch(struct bchannel *bch, int protocol)
handle_led(hw, (bch->nr == 1) ? LED_B1_OFF : handle_led(hw, (bch->nr == 1) ? LED_B1_OFF :
LED_B2_OFF); LED_B2_OFF);
} }
hfcsusb_ph_info(hw); return hfcsusb_ph_info(hw);
return 0;
} }
static void static void

View File

@ -630,17 +630,19 @@ static void
release_io(struct inf_hw *hw) release_io(struct inf_hw *hw)
{ {
if (hw->cfg.mode) { if (hw->cfg.mode) {
if (hw->cfg.p) { if (hw->cfg.mode == AM_MEMIO) {
release_mem_region(hw->cfg.start, hw->cfg.size); release_mem_region(hw->cfg.start, hw->cfg.size);
iounmap(hw->cfg.p); if (hw->cfg.p)
iounmap(hw->cfg.p);
} else } else
release_region(hw->cfg.start, hw->cfg.size); release_region(hw->cfg.start, hw->cfg.size);
hw->cfg.mode = AM_NONE; hw->cfg.mode = AM_NONE;
} }
if (hw->addr.mode) { if (hw->addr.mode) {
if (hw->addr.p) { if (hw->addr.mode == AM_MEMIO) {
release_mem_region(hw->addr.start, hw->addr.size); release_mem_region(hw->addr.start, hw->addr.size);
iounmap(hw->addr.p); if (hw->addr.p)
iounmap(hw->addr.p);
} else } else
release_region(hw->addr.start, hw->addr.size); release_region(hw->addr.start, hw->addr.size);
hw->addr.mode = AM_NONE; hw->addr.mode = AM_NONE;
@ -670,9 +672,12 @@ setup_io(struct inf_hw *hw)
(ulong)hw->cfg.start, (ulong)hw->cfg.size); (ulong)hw->cfg.start, (ulong)hw->cfg.size);
return err; return err;
} }
if (hw->ci->cfg_mode == AM_MEMIO)
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
hw->cfg.mode = hw->ci->cfg_mode; hw->cfg.mode = hw->ci->cfg_mode;
if (hw->ci->cfg_mode == AM_MEMIO) {
hw->cfg.p = ioremap(hw->cfg.start, hw->cfg.size);
if (!hw->cfg.p)
return -ENOMEM;
}
if (debug & DEBUG_HW) if (debug & DEBUG_HW)
pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n", pr_notice("%s: IO cfg %lx (%lu bytes) mode%d\n",
hw->name, (ulong)hw->cfg.start, hw->name, (ulong)hw->cfg.start,
@ -697,12 +702,12 @@ setup_io(struct inf_hw *hw)
(ulong)hw->addr.start, (ulong)hw->addr.size); (ulong)hw->addr.start, (ulong)hw->addr.size);
return err; return err;
} }
hw->addr.mode = hw->ci->addr_mode;
if (hw->ci->addr_mode == AM_MEMIO) { if (hw->ci->addr_mode == AM_MEMIO) {
hw->addr.p = ioremap(hw->addr.start, hw->addr.size); hw->addr.p = ioremap(hw->addr.start, hw->addr.size);
if (unlikely(!hw->addr.p)) if (!hw->addr.p)
return -ENOMEM; return -ENOMEM;
} }
hw->addr.mode = hw->ci->addr_mode;
if (debug & DEBUG_HW) if (debug & DEBUG_HW)
pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n", pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
hw->name, (ulong)hw->addr.start, hw->name, (ulong)hw->addr.start,

View File

@ -307,7 +307,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
usleep_range(3000, 6000); usleep_range(3000, 6000);
ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); ret = lp55xx_read(chip, LP5523_REG_STATUS, &status);
if (ret) if (ret)
return ret; goto out;
status &= LP5523_ENG_STATUS_MASK; status &= LP5523_ENG_STATUS_MASK;
if (status != LP5523_ENG_STATUS_MASK) { if (status != LP5523_ENG_STATUS_MASK) {

View File

@ -281,7 +281,7 @@ static int sp8870_set_frontend_parameters(struct dvb_frontend *fe)
// read status reg in order to clear pending irqs // read status reg in order to clear pending irqs
err = sp8870_readreg(state, 0x200); err = sp8870_readreg(state, 0x200);
if (err) if (err < 0)
return err; return err;
// system controller start // system controller start

View File

@ -915,7 +915,6 @@ static int rcar_drif_g_fmt_sdr_cap(struct file *file, void *priv,
{ {
struct rcar_drif_sdr *sdr = video_drvdata(file); struct rcar_drif_sdr *sdr = video_drvdata(file);
memset(f->fmt.sdr.reserved, 0, sizeof(f->fmt.sdr.reserved));
f->fmt.sdr.pixelformat = sdr->fmt->pixelformat; f->fmt.sdr.pixelformat = sdr->fmt->pixelformat;
f->fmt.sdr.buffersize = sdr->fmt->buffersize; f->fmt.sdr.buffersize = sdr->fmt->buffersize;

View File

@ -1424,7 +1424,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam; struct cam *cam;
int ret;
sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ; sd->mainsFreq = FREQ_DEF == V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
reset_camera_params(gspca_dev); reset_camera_params(gspca_dev);
@ -1436,10 +1435,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam->cam_mode = mode; cam->cam_mode = mode;
cam->nmodes = ARRAY_SIZE(mode); cam->nmodes = ARRAY_SIZE(mode);
ret = goto_low_power(gspca_dev); goto_low_power(gspca_dev);
if (ret)
gspca_err(gspca_dev, "Cannot go to low power mode: %d\n",
ret);
/* Check the firmware version. */ /* Check the firmware version. */
sd->params.version.firmwareVersion = 0; sd->params.version.firmwareVersion = 0;
get_version_information(gspca_dev); get_version_information(gspca_dev);

View File

@ -195,7 +195,7 @@ static const struct v4l2_ctrl_config mt9m111_greenbal_cfg = {
int mt9m111_probe(struct sd *sd) int mt9m111_probe(struct sd *sd)
{ {
u8 data[2] = {0x00, 0x00}; u8 data[2] = {0x00, 0x00};
int i, rc = 0; int i, err;
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) { if (force_sensor) {
@ -213,18 +213,18 @@ int mt9m111_probe(struct sd *sd)
/* Do the preinit */ /* Do the preinit */
for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) { for (i = 0; i < ARRAY_SIZE(preinit_mt9m111); i++) {
if (preinit_mt9m111[i][0] == BRIDGE) { if (preinit_mt9m111[i][0] == BRIDGE) {
rc |= m5602_write_bridge(sd, err = m5602_write_bridge(sd,
preinit_mt9m111[i][1], preinit_mt9m111[i][1],
preinit_mt9m111[i][2]); preinit_mt9m111[i][2]);
} else { } else {
data[0] = preinit_mt9m111[i][2]; data[0] = preinit_mt9m111[i][2];
data[1] = preinit_mt9m111[i][3]; data[1] = preinit_mt9m111[i][3];
rc |= m5602_write_sensor(sd, err = m5602_write_sensor(sd,
preinit_mt9m111[i][1], data, 2); preinit_mt9m111[i][1], data, 2);
} }
if (err < 0)
return err;
} }
if (rc < 0)
return rc;
if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2)) if (m5602_read_sensor(sd, MT9M111_SC_CHIPVER, data, 2))
return -ENODEV; return -ENODEV;

View File

@ -154,8 +154,8 @@ static const struct v4l2_ctrl_config po1030_greenbal_cfg = {
int po1030_probe(struct sd *sd) int po1030_probe(struct sd *sd)
{ {
int rc = 0;
u8 dev_id_h = 0, i; u8 dev_id_h = 0, i;
int err;
struct gspca_dev *gspca_dev = (struct gspca_dev *)sd; struct gspca_dev *gspca_dev = (struct gspca_dev *)sd;
if (force_sensor) { if (force_sensor) {
@ -174,14 +174,14 @@ int po1030_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) { for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
u8 data = preinit_po1030[i][2]; u8 data = preinit_po1030[i][2];
if (preinit_po1030[i][0] == SENSOR) if (preinit_po1030[i][0] == SENSOR)
rc |= m5602_write_sensor(sd, err = m5602_write_sensor(sd, preinit_po1030[i][1],
preinit_po1030[i][1], &data, 1); &data, 1);
else else
rc |= m5602_write_bridge(sd, preinit_po1030[i][1], err = m5602_write_bridge(sd, preinit_po1030[i][1],
data); data);
if (err < 0)
return err;
} }
if (rc < 0)
return rc;
if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1)) if (m5602_read_sensor(sd, PO1030_DEVID_H, &dev_id_h, 1))
return -ENODEV; return -ENODEV;

View File

@ -763,7 +763,8 @@ static int at24_probe(struct i2c_client *client)
at24->nvmem = devm_nvmem_register(dev, &nvmem_config); at24->nvmem = devm_nvmem_register(dev, &nvmem_config);
if (IS_ERR(at24->nvmem)) { if (IS_ERR(at24->nvmem)) {
pm_runtime_disable(dev); pm_runtime_disable(dev);
regulator_disable(at24->vcc_reg); if (!pm_runtime_status_suspended(dev))
regulator_disable(at24->vcc_reg);
return PTR_ERR(at24->nvmem); return PTR_ERR(at24->nvmem);
} }
@ -774,7 +775,8 @@ static int at24_probe(struct i2c_client *client)
err = at24_read(at24, 0, &test_byte, 1); err = at24_read(at24, 0, &test_byte, 1);
if (err) { if (err) {
pm_runtime_disable(dev); pm_runtime_disable(dev);
regulator_disable(at24->vcc_reg); if (!pm_runtime_status_suspended(dev))
regulator_disable(at24->vcc_reg);
return -ENODEV; return -ENODEV;
} }

View File

@ -2017,7 +2017,7 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
if (completion_value >= target_value) { if (completion_value >= target_value) {
*status = CS_WAIT_STATUS_COMPLETED; *status = CS_WAIT_STATUS_COMPLETED;
} else { } else {
timeout -= jiffies_to_usecs(completion_rc); timeout = completion_rc;
goto wait_again; goto wait_again;
} }
} else { } else {

View File

@ -362,12 +362,9 @@ static int fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg,
} }
if (err_val & CPU_BOOT_ERR0_SECURITY_NOT_RDY) { if (err_val & CPU_BOOT_ERR0_SECURITY_NOT_RDY) {
dev_warn(hdev->dev, dev_err(hdev->dev,
"Device boot warning - security not ready\n"); "Device boot warning - security not ready\n");
/* This is a warning so we don't want it to disable the err_exists = true;
* device
*/
err_val &= ~CPU_BOOT_ERR0_SECURITY_NOT_RDY;
} }
if (err_val & CPU_BOOT_ERR0_SECURITY_FAIL) { if (err_val & CPU_BOOT_ERR0_SECURITY_FAIL) {
@ -403,7 +400,8 @@ static int fw_read_errors(struct hl_device *hdev, u32 boot_err0_reg,
err_exists = true; err_exists = true;
} }
if (err_exists) if (err_exists && ((err_val & ~CPU_BOOT_ERR0_ENABLED) &
lower_32_bits(hdev->boot_error_status_mask)))
return -EIO; return -EIO;
return 0; return 0;
@ -661,18 +659,13 @@ int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, u64 *total_energy)
return rc; return rc;
} }
int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index, int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index,
enum pll_index *pll_index) enum pll_index *pll_index)
{ {
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
u8 pll_byte, pll_bit_off; u8 pll_byte, pll_bit_off;
bool dynamic_pll; bool dynamic_pll;
int fw_pll_idx;
if (input_pll_index >= PLL_MAX) {
dev_err(hdev->dev, "PLL index %d is out of range\n",
input_pll_index);
return -EINVAL;
}
dynamic_pll = prop->fw_security_status_valid && dynamic_pll = prop->fw_security_status_valid &&
(prop->fw_app_security_map & CPU_BOOT_DEV_STS0_DYN_PLL_EN); (prop->fw_app_security_map & CPU_BOOT_DEV_STS0_DYN_PLL_EN);
@ -680,28 +673,39 @@ int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index,
if (!dynamic_pll) { if (!dynamic_pll) {
/* /*
* in case we are working with legacy FW (each asic has unique * in case we are working with legacy FW (each asic has unique
* PLL numbering) extract the legacy numbering * PLL numbering) use the driver based index as they are
* aligned with fw legacy numbering
*/ */
*pll_index = hdev->legacy_pll_map[input_pll_index]; *pll_index = input_pll_index;
return 0; return 0;
} }
/* PLL map is a u8 array */ /* retrieve a FW compatible PLL index based on
pll_byte = prop->cpucp_info.pll_map[input_pll_index >> 3]; * ASIC specific user request
pll_bit_off = input_pll_index & 0x7; */
fw_pll_idx = hdev->asic_funcs->map_pll_idx_to_fw_idx(input_pll_index);
if (!(pll_byte & BIT(pll_bit_off))) { if (fw_pll_idx < 0) {
dev_err(hdev->dev, "PLL index %d is not supported\n", dev_err(hdev->dev, "Invalid PLL index (%u) error %d\n",
input_pll_index); input_pll_index, fw_pll_idx);
return -EINVAL; return -EINVAL;
} }
*pll_index = input_pll_index; /* PLL map is a u8 array */
pll_byte = prop->cpucp_info.pll_map[fw_pll_idx >> 3];
pll_bit_off = fw_pll_idx & 0x7;
if (!(pll_byte & BIT(pll_bit_off))) {
dev_err(hdev->dev, "PLL index %d is not supported\n",
fw_pll_idx);
return -EINVAL;
}
*pll_index = fw_pll_idx;
return 0; return 0;
} }
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index, int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index,
u16 *pll_freq_arr) u16 *pll_freq_arr)
{ {
struct cpucp_packet pkt; struct cpucp_packet pkt;
@ -844,8 +848,13 @@ int hl_fw_read_preboot_status(struct hl_device *hdev, u32 cpu_boot_status_reg,
if (rc) { if (rc) {
dev_err(hdev->dev, "Failed to read preboot version\n"); dev_err(hdev->dev, "Failed to read preboot version\n");
detect_cpu_boot_status(hdev, status); detect_cpu_boot_status(hdev, status);
fw_read_errors(hdev, boot_err0_reg,
cpu_security_boot_status_reg); /* If we read all FF, then something is totally wrong, no point
* of reading specific errors
*/
if (status != -1)
fw_read_errors(hdev, boot_err0_reg,
cpu_security_boot_status_reg);
return -EIO; return -EIO;
} }

View File

@ -930,6 +930,9 @@ enum div_select_defs {
* driver is ready to receive asynchronous events. This * driver is ready to receive asynchronous events. This
* function should be called during the first init and * function should be called during the first init and
* after every hard-reset of the device * after every hard-reset of the device
* @get_msi_info: Retrieve asic-specific MSI ID of the f/w async event
* @map_pll_idx_to_fw_idx: convert driver specific per asic PLL index to
* generic f/w compatible PLL Indexes
*/ */
struct hl_asic_funcs { struct hl_asic_funcs {
int (*early_init)(struct hl_device *hdev); int (*early_init)(struct hl_device *hdev);
@ -1054,6 +1057,7 @@ struct hl_asic_funcs {
u32 block_id, u32 block_size); u32 block_id, u32 block_size);
void (*enable_events_from_fw)(struct hl_device *hdev); void (*enable_events_from_fw)(struct hl_device *hdev);
void (*get_msi_info)(u32 *table); void (*get_msi_info)(u32 *table);
int (*map_pll_idx_to_fw_idx)(u32 pll_idx);
}; };
@ -1950,8 +1954,6 @@ struct hl_mmu_funcs {
* @aggregated_cs_counters: aggregated cs counters among all contexts * @aggregated_cs_counters: aggregated cs counters among all contexts
* @mmu_priv: device-specific MMU data. * @mmu_priv: device-specific MMU data.
* @mmu_func: device-related MMU functions. * @mmu_func: device-related MMU functions.
* @legacy_pll_map: map holding map between dynamic (common) PLL indexes and
* static (asic specific) PLL indexes.
* @dram_used_mem: current DRAM memory consumption. * @dram_used_mem: current DRAM memory consumption.
* @timeout_jiffies: device CS timeout value. * @timeout_jiffies: device CS timeout value.
* @max_power: the max power of the device, as configured by the sysadmin. This * @max_power: the max power of the device, as configured by the sysadmin. This
@ -1960,6 +1962,12 @@ struct hl_mmu_funcs {
* @clock_gating_mask: is clock gating enabled. bitmask that represents the * @clock_gating_mask: is clock gating enabled. bitmask that represents the
* different engines. See debugfs-driver-habanalabs for * different engines. See debugfs-driver-habanalabs for
* details. * details.
* @boot_error_status_mask: contains a mask of the device boot error status.
* Each bit represents a different error, according to
* the defines in hl_boot_if.h. If the bit is cleared,
* the error will be ignored by the driver during
* device initialization. Mainly used to debug and
* workaround firmware bugs
* @in_reset: is device in reset flow. * @in_reset: is device in reset flow.
* @curr_pll_profile: current PLL profile. * @curr_pll_profile: current PLL profile.
* @card_type: Various ASICs have several card types. This indicates the card * @card_type: Various ASICs have several card types. This indicates the card
@ -2071,12 +2079,11 @@ struct hl_device {
struct hl_mmu_priv mmu_priv; struct hl_mmu_priv mmu_priv;
struct hl_mmu_funcs mmu_func[MMU_NUM_PGT_LOCATIONS]; struct hl_mmu_funcs mmu_func[MMU_NUM_PGT_LOCATIONS];
enum pll_index *legacy_pll_map;
atomic64_t dram_used_mem; atomic64_t dram_used_mem;
u64 timeout_jiffies; u64 timeout_jiffies;
u64 max_power; u64 max_power;
u64 clock_gating_mask; u64 clock_gating_mask;
u64 boot_error_status_mask;
atomic_t in_reset; atomic_t in_reset;
enum hl_pll_frequency curr_pll_profile; enum hl_pll_frequency curr_pll_profile;
enum cpucp_card_types card_type; enum cpucp_card_types card_type;
@ -2387,9 +2394,9 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
struct hl_info_pci_counters *counters); struct hl_info_pci_counters *counters);
int hl_fw_cpucp_total_energy_get(struct hl_device *hdev, int hl_fw_cpucp_total_energy_get(struct hl_device *hdev,
u64 *total_energy); u64 *total_energy);
int get_used_pll_index(struct hl_device *hdev, enum pll_index input_pll_index, int get_used_pll_index(struct hl_device *hdev, u32 input_pll_index,
enum pll_index *pll_index); enum pll_index *pll_index);
int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, enum pll_index pll_index, int hl_fw_cpucp_pll_info_get(struct hl_device *hdev, u32 pll_index,
u16 *pll_freq_arr); u16 *pll_freq_arr);
int hl_fw_cpucp_power_get(struct hl_device *hdev, u64 *power); int hl_fw_cpucp_power_get(struct hl_device *hdev, u64 *power);
int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg, int hl_fw_init_cpu(struct hl_device *hdev, u32 cpu_boot_status_reg,
@ -2411,9 +2418,9 @@ int hl_pci_set_outbound_region(struct hl_device *hdev,
int hl_pci_init(struct hl_device *hdev); int hl_pci_init(struct hl_device *hdev);
void hl_pci_fini(struct hl_device *hdev); void hl_pci_fini(struct hl_device *hdev);
long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index, long hl_get_frequency(struct hl_device *hdev, u32 pll_index,
bool curr); bool curr);
void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index, void hl_set_frequency(struct hl_device *hdev, u32 pll_index,
u64 freq); u64 freq);
int hl_get_temperature(struct hl_device *hdev, int hl_get_temperature(struct hl_device *hdev,
int sensor_index, u32 attr, long *value); int sensor_index, u32 attr, long *value);

View File

@ -30,6 +30,7 @@ static DEFINE_MUTEX(hl_devs_idr_lock);
static int timeout_locked = 30; static int timeout_locked = 30;
static int reset_on_lockup = 1; static int reset_on_lockup = 1;
static int memory_scrub = 1; static int memory_scrub = 1;
static ulong boot_error_status_mask = ULONG_MAX;
module_param(timeout_locked, int, 0444); module_param(timeout_locked, int, 0444);
MODULE_PARM_DESC(timeout_locked, MODULE_PARM_DESC(timeout_locked,
@ -43,6 +44,10 @@ module_param(memory_scrub, int, 0444);
MODULE_PARM_DESC(memory_scrub, MODULE_PARM_DESC(memory_scrub,
"Scrub device memory in various states (0 = no, 1 = yes, default yes)"); "Scrub device memory in various states (0 = no, 1 = yes, default yes)");
module_param(boot_error_status_mask, ulong, 0444);
MODULE_PARM_DESC(boot_error_status_mask,
"Mask of the error status during device CPU boot (If bitX is cleared then error X is masked. Default all 1's)");
#define PCI_VENDOR_ID_HABANALABS 0x1da3 #define PCI_VENDOR_ID_HABANALABS 0x1da3
#define PCI_IDS_GOYA 0x0001 #define PCI_IDS_GOYA 0x0001
@ -319,6 +324,8 @@ int create_hdev(struct hl_device **dev, struct pci_dev *pdev,
hdev->major = hl_major; hdev->major = hl_major;
hdev->reset_on_lockup = reset_on_lockup; hdev->reset_on_lockup = reset_on_lockup;
hdev->memory_scrub = memory_scrub; hdev->memory_scrub = memory_scrub;
hdev->boot_error_status_mask = boot_error_status_mask;
hdev->pldm = 0; hdev->pldm = 0;
set_driver_behavior_per_device(hdev); set_driver_behavior_per_device(hdev);

View File

@ -9,7 +9,7 @@
#include <linux/pci.h> #include <linux/pci.h>
long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index, long hl_get_frequency(struct hl_device *hdev, u32 pll_index,
bool curr) bool curr)
{ {
struct cpucp_packet pkt; struct cpucp_packet pkt;
@ -44,7 +44,7 @@ long hl_get_frequency(struct hl_device *hdev, enum pll_index pll_index,
return (long) result; return (long) result;
} }
void hl_set_frequency(struct hl_device *hdev, enum pll_index pll_index, void hl_set_frequency(struct hl_device *hdev, u32 pll_index,
u64 freq) u64 freq)
{ {
struct cpucp_packet pkt; struct cpucp_packet pkt;

View File

@ -105,36 +105,6 @@
#define GAUDI_PLL_MAX 10 #define GAUDI_PLL_MAX 10
/*
* this enum kept here for compatibility with old FW (in which each asic has
* unique PLL numbering
*/
enum gaudi_pll_index {
GAUDI_CPU_PLL = 0,
GAUDI_PCI_PLL,
GAUDI_SRAM_PLL,
GAUDI_HBM_PLL,
GAUDI_NIC_PLL,
GAUDI_DMA_PLL,
GAUDI_MESH_PLL,
GAUDI_MME_PLL,
GAUDI_TPC_PLL,
GAUDI_IF_PLL,
};
static enum pll_index gaudi_pll_map[PLL_MAX] = {
[CPU_PLL] = GAUDI_CPU_PLL,
[PCI_PLL] = GAUDI_PCI_PLL,
[SRAM_PLL] = GAUDI_SRAM_PLL,
[HBM_PLL] = GAUDI_HBM_PLL,
[NIC_PLL] = GAUDI_NIC_PLL,
[DMA_PLL] = GAUDI_DMA_PLL,
[MESH_PLL] = GAUDI_MESH_PLL,
[MME_PLL] = GAUDI_MME_PLL,
[TPC_PLL] = GAUDI_TPC_PLL,
[IF_PLL] = GAUDI_IF_PLL,
};
static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = { static const char gaudi_irq_name[GAUDI_MSI_ENTRIES][GAUDI_MAX_STRING_LEN] = {
"gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3", "gaudi cq 0_0", "gaudi cq 0_1", "gaudi cq 0_2", "gaudi cq 0_3",
"gaudi cq 1_0", "gaudi cq 1_1", "gaudi cq 1_2", "gaudi cq 1_3", "gaudi cq 1_0", "gaudi cq 1_1", "gaudi cq 1_2", "gaudi cq 1_3",
@ -810,7 +780,7 @@ static int gaudi_fetch_psoc_frequency(struct hl_device *hdev)
freq = 0; freq = 0;
} }
} else { } else {
rc = hl_fw_cpucp_pll_info_get(hdev, CPU_PLL, pll_freq_arr); rc = hl_fw_cpucp_pll_info_get(hdev, HL_GAUDI_CPU_PLL, pll_freq_arr);
if (rc) if (rc)
return rc; return rc;
@ -1652,9 +1622,6 @@ static int gaudi_sw_init(struct hl_device *hdev)
hdev->asic_specific = gaudi; hdev->asic_specific = gaudi;
/* store legacy PLL map */
hdev->legacy_pll_map = gaudi_pll_map;
/* Create DMA pool for small allocations */ /* Create DMA pool for small allocations */
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev), hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
&hdev->pdev->dev, GAUDI_DMA_POOL_BLK_SIZE, 8, 0); &hdev->pdev->dev, GAUDI_DMA_POOL_BLK_SIZE, 8, 0);
@ -5612,6 +5579,7 @@ static int gaudi_memset_device_memory(struct hl_device *hdev, u64 addr,
struct hl_cs_job *job; struct hl_cs_job *job;
u32 cb_size, ctl, err_cause; u32 cb_size, ctl, err_cause;
struct hl_cb *cb; struct hl_cb *cb;
u64 id;
int rc; int rc;
cb = hl_cb_kernel_create(hdev, PAGE_SIZE, false); cb = hl_cb_kernel_create(hdev, PAGE_SIZE, false);
@ -5678,8 +5646,9 @@ static int gaudi_memset_device_memory(struct hl_device *hdev, u64 addr,
} }
release_cb: release_cb:
id = cb->id;
hl_cb_put(cb); hl_cb_put(cb);
hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, cb->id << PAGE_SHIFT); hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, id << PAGE_SHIFT);
return rc; return rc;
} }
@ -8783,6 +8752,23 @@ static void gaudi_enable_events_from_fw(struct hl_device *hdev)
WREG32(mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR, GAUDI_EVENT_INTS_REGISTER); WREG32(mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR, GAUDI_EVENT_INTS_REGISTER);
} }
static int gaudi_map_pll_idx_to_fw_idx(u32 pll_idx)
{
switch (pll_idx) {
case HL_GAUDI_CPU_PLL: return CPU_PLL;
case HL_GAUDI_PCI_PLL: return PCI_PLL;
case HL_GAUDI_NIC_PLL: return NIC_PLL;
case HL_GAUDI_DMA_PLL: return DMA_PLL;
case HL_GAUDI_MESH_PLL: return MESH_PLL;
case HL_GAUDI_MME_PLL: return MME_PLL;
case HL_GAUDI_TPC_PLL: return TPC_PLL;
case HL_GAUDI_IF_PLL: return IF_PLL;
case HL_GAUDI_SRAM_PLL: return SRAM_PLL;
case HL_GAUDI_HBM_PLL: return HBM_PLL;
default: return -EINVAL;
}
}
static const struct hl_asic_funcs gaudi_funcs = { static const struct hl_asic_funcs gaudi_funcs = {
.early_init = gaudi_early_init, .early_init = gaudi_early_init,
.early_fini = gaudi_early_fini, .early_fini = gaudi_early_fini,
@ -8866,7 +8852,8 @@ static const struct hl_asic_funcs gaudi_funcs = {
.ack_protection_bits_errors = gaudi_ack_protection_bits_errors, .ack_protection_bits_errors = gaudi_ack_protection_bits_errors,
.get_hw_block_id = gaudi_get_hw_block_id, .get_hw_block_id = gaudi_get_hw_block_id,
.hw_block_mmap = gaudi_block_mmap, .hw_block_mmap = gaudi_block_mmap,
.enable_events_from_fw = gaudi_enable_events_from_fw .enable_events_from_fw = gaudi_enable_events_from_fw,
.map_pll_idx_to_fw_idx = gaudi_map_pll_idx_to_fw_idx
}; };
/** /**

View File

@ -13,7 +13,7 @@ void gaudi_set_pll_profile(struct hl_device *hdev, enum hl_pll_frequency freq)
struct gaudi_device *gaudi = hdev->asic_specific; struct gaudi_device *gaudi = hdev->asic_specific;
if (freq == PLL_LAST) if (freq == PLL_LAST)
hl_set_frequency(hdev, MME_PLL, gaudi->max_freq_value); hl_set_frequency(hdev, HL_GAUDI_MME_PLL, gaudi->max_freq_value);
} }
int gaudi_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk) int gaudi_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk)
@ -23,7 +23,7 @@ int gaudi_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk)
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, false); value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, false);
if (value < 0) { if (value < 0) {
dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n", dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n",
@ -33,7 +33,7 @@ int gaudi_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk)
*max_clk = (value / 1000 / 1000); *max_clk = (value / 1000 / 1000);
value = hl_get_frequency(hdev, MME_PLL, true); value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, true);
if (value < 0) { if (value < 0) {
dev_err(hdev->dev, dev_err(hdev->dev,
@ -57,7 +57,7 @@ static ssize_t clk_max_freq_mhz_show(struct device *dev,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, false); value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, false);
gaudi->max_freq_value = value; gaudi->max_freq_value = value;
@ -85,7 +85,7 @@ static ssize_t clk_max_freq_mhz_store(struct device *dev,
gaudi->max_freq_value = value * 1000 * 1000; gaudi->max_freq_value = value * 1000 * 1000;
hl_set_frequency(hdev, MME_PLL, gaudi->max_freq_value); hl_set_frequency(hdev, HL_GAUDI_MME_PLL, gaudi->max_freq_value);
fail: fail:
return count; return count;
@ -100,7 +100,7 @@ static ssize_t clk_cur_freq_mhz_show(struct device *dev,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, true); value = hl_get_frequency(hdev, HL_GAUDI_MME_PLL, true);
return sprintf(buf, "%lu\n", (value / 1000 / 1000)); return sprintf(buf, "%lu\n", (value / 1000 / 1000));
} }

View File

@ -118,30 +118,6 @@
#define IS_MME_IDLE(mme_arch_sts) \ #define IS_MME_IDLE(mme_arch_sts) \
(((mme_arch_sts) & MME_ARCH_IDLE_MASK) == MME_ARCH_IDLE_MASK) (((mme_arch_sts) & MME_ARCH_IDLE_MASK) == MME_ARCH_IDLE_MASK)
/*
* this enum kept here for compatibility with old FW (in which each asic has
* unique PLL numbering
*/
enum goya_pll_index {
GOYA_CPU_PLL = 0,
GOYA_IC_PLL,
GOYA_MC_PLL,
GOYA_MME_PLL,
GOYA_PCI_PLL,
GOYA_EMMC_PLL,
GOYA_TPC_PLL,
};
static enum pll_index goya_pll_map[PLL_MAX] = {
[CPU_PLL] = GOYA_CPU_PLL,
[IC_PLL] = GOYA_IC_PLL,
[MC_PLL] = GOYA_MC_PLL,
[MME_PLL] = GOYA_MME_PLL,
[PCI_PLL] = GOYA_PCI_PLL,
[EMMC_PLL] = GOYA_EMMC_PLL,
[TPC_PLL] = GOYA_TPC_PLL,
};
static const char goya_irq_name[GOYA_MSIX_ENTRIES][GOYA_MAX_STRING_LEN] = { static const char goya_irq_name[GOYA_MSIX_ENTRIES][GOYA_MAX_STRING_LEN] = {
"goya cq 0", "goya cq 1", "goya cq 2", "goya cq 3", "goya cq 0", "goya cq 1", "goya cq 2", "goya cq 3",
"goya cq 4", "goya cpu eq" "goya cq 4", "goya cpu eq"
@ -775,7 +751,8 @@ static void goya_fetch_psoc_frequency(struct hl_device *hdev)
freq = 0; freq = 0;
} }
} else { } else {
rc = hl_fw_cpucp_pll_info_get(hdev, PCI_PLL, pll_freq_arr); rc = hl_fw_cpucp_pll_info_get(hdev, HL_GOYA_PCI_PLL,
pll_freq_arr);
if (rc) if (rc)
return; return;
@ -897,9 +874,6 @@ static int goya_sw_init(struct hl_device *hdev)
hdev->asic_specific = goya; hdev->asic_specific = goya;
/* store legacy PLL map */
hdev->legacy_pll_map = goya_pll_map;
/* Create DMA pool for small allocations */ /* Create DMA pool for small allocations */
hdev->dma_pool = dma_pool_create(dev_name(hdev->dev), hdev->dma_pool = dma_pool_create(dev_name(hdev->dev),
&hdev->pdev->dev, GOYA_DMA_POOL_BLK_SIZE, 8, 0); &hdev->pdev->dev, GOYA_DMA_POOL_BLK_SIZE, 8, 0);
@ -5512,6 +5486,20 @@ static void goya_enable_events_from_fw(struct hl_device *hdev)
GOYA_ASYNC_EVENT_ID_INTS_REGISTER); GOYA_ASYNC_EVENT_ID_INTS_REGISTER);
} }
static int goya_map_pll_idx_to_fw_idx(u32 pll_idx)
{
switch (pll_idx) {
case HL_GOYA_CPU_PLL: return CPU_PLL;
case HL_GOYA_PCI_PLL: return PCI_PLL;
case HL_GOYA_MME_PLL: return MME_PLL;
case HL_GOYA_TPC_PLL: return TPC_PLL;
case HL_GOYA_IC_PLL: return IC_PLL;
case HL_GOYA_MC_PLL: return MC_PLL;
case HL_GOYA_EMMC_PLL: return EMMC_PLL;
default: return -EINVAL;
}
}
static const struct hl_asic_funcs goya_funcs = { static const struct hl_asic_funcs goya_funcs = {
.early_init = goya_early_init, .early_init = goya_early_init,
.early_fini = goya_early_fini, .early_fini = goya_early_fini,
@ -5595,7 +5583,8 @@ static const struct hl_asic_funcs goya_funcs = {
.ack_protection_bits_errors = goya_ack_protection_bits_errors, .ack_protection_bits_errors = goya_ack_protection_bits_errors,
.get_hw_block_id = goya_get_hw_block_id, .get_hw_block_id = goya_get_hw_block_id,
.hw_block_mmap = goya_block_mmap, .hw_block_mmap = goya_block_mmap,
.enable_events_from_fw = goya_enable_events_from_fw .enable_events_from_fw = goya_enable_events_from_fw,
.map_pll_idx_to_fw_idx = goya_map_pll_idx_to_fw_idx
}; };
/* /*

View File

@ -13,19 +13,19 @@ void goya_set_pll_profile(struct hl_device *hdev, enum hl_pll_frequency freq)
switch (freq) { switch (freq) {
case PLL_HIGH: case PLL_HIGH:
hl_set_frequency(hdev, MME_PLL, hdev->high_pll); hl_set_frequency(hdev, HL_GOYA_MME_PLL, hdev->high_pll);
hl_set_frequency(hdev, TPC_PLL, hdev->high_pll); hl_set_frequency(hdev, HL_GOYA_TPC_PLL, hdev->high_pll);
hl_set_frequency(hdev, IC_PLL, hdev->high_pll); hl_set_frequency(hdev, HL_GOYA_IC_PLL, hdev->high_pll);
break; break;
case PLL_LOW: case PLL_LOW:
hl_set_frequency(hdev, MME_PLL, GOYA_PLL_FREQ_LOW); hl_set_frequency(hdev, HL_GOYA_MME_PLL, GOYA_PLL_FREQ_LOW);
hl_set_frequency(hdev, TPC_PLL, GOYA_PLL_FREQ_LOW); hl_set_frequency(hdev, HL_GOYA_TPC_PLL, GOYA_PLL_FREQ_LOW);
hl_set_frequency(hdev, IC_PLL, GOYA_PLL_FREQ_LOW); hl_set_frequency(hdev, HL_GOYA_IC_PLL, GOYA_PLL_FREQ_LOW);
break; break;
case PLL_LAST: case PLL_LAST:
hl_set_frequency(hdev, MME_PLL, goya->mme_clk); hl_set_frequency(hdev, HL_GOYA_MME_PLL, goya->mme_clk);
hl_set_frequency(hdev, TPC_PLL, goya->tpc_clk); hl_set_frequency(hdev, HL_GOYA_TPC_PLL, goya->tpc_clk);
hl_set_frequency(hdev, IC_PLL, goya->ic_clk); hl_set_frequency(hdev, HL_GOYA_IC_PLL, goya->ic_clk);
break; break;
default: default:
dev_err(hdev->dev, "unknown frequency setting\n"); dev_err(hdev->dev, "unknown frequency setting\n");
@ -39,7 +39,7 @@ int goya_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk)
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, false); value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, false);
if (value < 0) { if (value < 0) {
dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n", dev_err(hdev->dev, "Failed to retrieve device max clock %ld\n",
@ -49,7 +49,7 @@ int goya_get_clk_rate(struct hl_device *hdev, u32 *cur_clk, u32 *max_clk)
*max_clk = (value / 1000 / 1000); *max_clk = (value / 1000 / 1000);
value = hl_get_frequency(hdev, MME_PLL, true); value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, true);
if (value < 0) { if (value < 0) {
dev_err(hdev->dev, dev_err(hdev->dev,
@ -72,7 +72,7 @@ static ssize_t mme_clk_show(struct device *dev, struct device_attribute *attr,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, false); value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, false);
if (value < 0) if (value < 0)
return value; return value;
@ -105,7 +105,7 @@ static ssize_t mme_clk_store(struct device *dev, struct device_attribute *attr,
goto fail; goto fail;
} }
hl_set_frequency(hdev, MME_PLL, value); hl_set_frequency(hdev, HL_GOYA_MME_PLL, value);
goya->mme_clk = value; goya->mme_clk = value;
fail: fail:
@ -121,7 +121,7 @@ static ssize_t tpc_clk_show(struct device *dev, struct device_attribute *attr,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, TPC_PLL, false); value = hl_get_frequency(hdev, HL_GOYA_TPC_PLL, false);
if (value < 0) if (value < 0)
return value; return value;
@ -154,7 +154,7 @@ static ssize_t tpc_clk_store(struct device *dev, struct device_attribute *attr,
goto fail; goto fail;
} }
hl_set_frequency(hdev, TPC_PLL, value); hl_set_frequency(hdev, HL_GOYA_TPC_PLL, value);
goya->tpc_clk = value; goya->tpc_clk = value;
fail: fail:
@ -170,7 +170,7 @@ static ssize_t ic_clk_show(struct device *dev, struct device_attribute *attr,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, IC_PLL, false); value = hl_get_frequency(hdev, HL_GOYA_IC_PLL, false);
if (value < 0) if (value < 0)
return value; return value;
@ -203,7 +203,7 @@ static ssize_t ic_clk_store(struct device *dev, struct device_attribute *attr,
goto fail; goto fail;
} }
hl_set_frequency(hdev, IC_PLL, value); hl_set_frequency(hdev, HL_GOYA_IC_PLL, value);
goya->ic_clk = value; goya->ic_clk = value;
fail: fail:
@ -219,7 +219,7 @@ static ssize_t mme_clk_curr_show(struct device *dev,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, MME_PLL, true); value = hl_get_frequency(hdev, HL_GOYA_MME_PLL, true);
if (value < 0) if (value < 0)
return value; return value;
@ -236,7 +236,7 @@ static ssize_t tpc_clk_curr_show(struct device *dev,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, TPC_PLL, true); value = hl_get_frequency(hdev, HL_GOYA_TPC_PLL, true);
if (value < 0) if (value < 0)
return value; return value;
@ -253,7 +253,7 @@ static ssize_t ic_clk_curr_show(struct device *dev,
if (!hl_device_operational(hdev, NULL)) if (!hl_device_operational(hdev, NULL))
return -ENODEV; return -ENODEV;
value = hl_get_frequency(hdev, IC_PLL, true); value = hl_get_frequency(hdev, HL_GOYA_IC_PLL, true);
if (value < 0) if (value < 0)
return value; return value;

View File

@ -134,7 +134,7 @@ static struct ics932s401_data *ics932s401_update_device(struct device *dev)
for (i = 0; i < NUM_MIRRORED_REGS; i++) { for (i = 0; i < NUM_MIRRORED_REGS; i++) {
temp = i2c_smbus_read_word_data(client, regs_to_copy[i]); temp = i2c_smbus_read_word_data(client, regs_to_copy[i]);
if (temp < 0) if (temp < 0)
data->regs[regs_to_copy[i]] = 0; temp = 0;
data->regs[regs_to_copy[i]] = temp >> 8; data->regs[regs_to_copy[i]] = temp >> 8;
} }

View File

@ -269,9 +269,6 @@ static netdev_tx_t caif_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct ser_device *ser; struct ser_device *ser;
if (WARN_ON(!dev))
return -EINVAL;
ser = netdev_priv(dev); ser = netdev_priv(dev);
/* Send flow off once, on high water mark */ /* Send flow off once, on high water mark */

View File

@ -1153,7 +1153,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
* @lio: per-network private data * @lio: per-network private data
* @start_stop: whether to start or stop * @start_stop: whether to start or stop
*/ */
static void send_rx_ctrl_cmd(struct lio *lio, int start_stop) static int send_rx_ctrl_cmd(struct lio *lio, int start_stop)
{ {
struct octeon_soft_command *sc; struct octeon_soft_command *sc;
union octnet_cmd *ncmd; union octnet_cmd *ncmd;
@ -1161,15 +1161,15 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
int retval; int retval;
if (oct->props[lio->ifidx].rx_on == start_stop) if (oct->props[lio->ifidx].rx_on == start_stop)
return; return 0;
sc = (struct octeon_soft_command *) sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
16, 0); 16, 0);
if (!sc) { if (!sc) {
netif_info(lio, rx_err, lio->netdev, netif_info(lio, rx_err, lio->netdev,
"Failed to allocate octeon_soft_command\n"); "Failed to allocate octeon_soft_command struct\n");
return; return -ENOMEM;
} }
ncmd = (union octnet_cmd *)sc->virtdptr; ncmd = (union octnet_cmd *)sc->virtdptr;
@ -1192,18 +1192,19 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
if (retval == IQ_SEND_FAILED) { if (retval == IQ_SEND_FAILED) {
netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n"); netif_info(lio, rx_err, lio->netdev, "Failed to send RX Control message\n");
octeon_free_soft_command(oct, sc); octeon_free_soft_command(oct, sc);
return;
} else { } else {
/* Sleep on a wait queue till the cond flag indicates that the /* Sleep on a wait queue till the cond flag indicates that the
* response arrived or timed-out. * response arrived or timed-out.
*/ */
retval = wait_for_sc_completion_timeout(oct, sc, 0); retval = wait_for_sc_completion_timeout(oct, sc, 0);
if (retval) if (retval)
return; return retval;
oct->props[lio->ifidx].rx_on = start_stop; oct->props[lio->ifidx].rx_on = start_stop;
WRITE_ONCE(sc->caller_is_done, true); WRITE_ONCE(sc->caller_is_done, true);
} }
return retval;
} }
/** /**
@ -1778,6 +1779,7 @@ static int liquidio_open(struct net_device *netdev)
struct octeon_device_priv *oct_priv = struct octeon_device_priv *oct_priv =
(struct octeon_device_priv *)oct->priv; (struct octeon_device_priv *)oct->priv;
struct napi_struct *napi, *n; struct napi_struct *napi, *n;
int ret = 0;
if (oct->props[lio->ifidx].napi_enabled == 0) { if (oct->props[lio->ifidx].napi_enabled == 0) {
tasklet_disable(&oct_priv->droq_tasklet); tasklet_disable(&oct_priv->droq_tasklet);
@ -1813,7 +1815,9 @@ static int liquidio_open(struct net_device *netdev)
netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n"); netif_info(lio, ifup, lio->netdev, "Interface Open, ready for traffic\n");
/* tell Octeon to start forwarding packets to host */ /* tell Octeon to start forwarding packets to host */
send_rx_ctrl_cmd(lio, 1); ret = send_rx_ctrl_cmd(lio, 1);
if (ret)
return ret;
/* start periodical statistics fetch */ /* start periodical statistics fetch */
INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats); INIT_DELAYED_WORK(&lio->stats_wk.work, lio_fetch_stats);
@ -1824,7 +1828,7 @@ static int liquidio_open(struct net_device *netdev)
dev_info(&oct->pci_dev->dev, "%s interface is opened\n", dev_info(&oct->pci_dev->dev, "%s interface is opened\n",
netdev->name); netdev->name);
return 0; return ret;
} }
/** /**
@ -1838,6 +1842,7 @@ static int liquidio_stop(struct net_device *netdev)
struct octeon_device_priv *oct_priv = struct octeon_device_priv *oct_priv =
(struct octeon_device_priv *)oct->priv; (struct octeon_device_priv *)oct->priv;
struct napi_struct *napi, *n; struct napi_struct *napi, *n;
int ret = 0;
ifstate_reset(lio, LIO_IFSTATE_RUNNING); ifstate_reset(lio, LIO_IFSTATE_RUNNING);
@ -1854,7 +1859,9 @@ static int liquidio_stop(struct net_device *netdev)
lio->link_changes++; lio->link_changes++;
/* Tell Octeon that nic interface is down. */ /* Tell Octeon that nic interface is down. */
send_rx_ctrl_cmd(lio, 0); ret = send_rx_ctrl_cmd(lio, 0);
if (ret)
return ret;
if (OCTEON_CN23XX_PF(oct)) { if (OCTEON_CN23XX_PF(oct)) {
if (!oct->msix_on) if (!oct->msix_on)
@ -1889,7 +1896,7 @@ static int liquidio_stop(struct net_device *netdev)
dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name);
return 0; return ret;
} }
/** /**

View File

@ -595,7 +595,7 @@ static void octeon_destroy_resources(struct octeon_device *oct)
* @lio: per-network private data * @lio: per-network private data
* @start_stop: whether to start or stop * @start_stop: whether to start or stop
*/ */
static void send_rx_ctrl_cmd(struct lio *lio, int start_stop) static int send_rx_ctrl_cmd(struct lio *lio, int start_stop)
{ {
struct octeon_device *oct = (struct octeon_device *)lio->oct_dev; struct octeon_device *oct = (struct octeon_device *)lio->oct_dev;
struct octeon_soft_command *sc; struct octeon_soft_command *sc;
@ -603,11 +603,16 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
int retval; int retval;
if (oct->props[lio->ifidx].rx_on == start_stop) if (oct->props[lio->ifidx].rx_on == start_stop)
return; return 0;
sc = (struct octeon_soft_command *) sc = (struct octeon_soft_command *)
octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE, octeon_alloc_soft_command(oct, OCTNET_CMD_SIZE,
16, 0); 16, 0);
if (!sc) {
netif_info(lio, rx_err, lio->netdev,
"Failed to allocate octeon_soft_command struct\n");
return -ENOMEM;
}
ncmd = (union octnet_cmd *)sc->virtdptr; ncmd = (union octnet_cmd *)sc->virtdptr;
@ -635,11 +640,13 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
*/ */
retval = wait_for_sc_completion_timeout(oct, sc, 0); retval = wait_for_sc_completion_timeout(oct, sc, 0);
if (retval) if (retval)
return; return retval;
oct->props[lio->ifidx].rx_on = start_stop; oct->props[lio->ifidx].rx_on = start_stop;
WRITE_ONCE(sc->caller_is_done, true); WRITE_ONCE(sc->caller_is_done, true);
} }
return retval;
} }
/** /**
@ -906,6 +913,7 @@ static int liquidio_open(struct net_device *netdev)
struct octeon_device_priv *oct_priv = struct octeon_device_priv *oct_priv =
(struct octeon_device_priv *)oct->priv; (struct octeon_device_priv *)oct->priv;
struct napi_struct *napi, *n; struct napi_struct *napi, *n;
int ret = 0;
if (!oct->props[lio->ifidx].napi_enabled) { if (!oct->props[lio->ifidx].napi_enabled) {
tasklet_disable(&oct_priv->droq_tasklet); tasklet_disable(&oct_priv->droq_tasklet);
@ -932,11 +940,13 @@ static int liquidio_open(struct net_device *netdev)
(LIQUIDIO_NDEV_STATS_POLL_TIME_MS)); (LIQUIDIO_NDEV_STATS_POLL_TIME_MS));
/* tell Octeon to start forwarding packets to host */ /* tell Octeon to start forwarding packets to host */
send_rx_ctrl_cmd(lio, 1); ret = send_rx_ctrl_cmd(lio, 1);
if (ret)
return ret;
dev_info(&oct->pci_dev->dev, "%s interface is opened\n", netdev->name); dev_info(&oct->pci_dev->dev, "%s interface is opened\n", netdev->name);
return 0; return ret;
} }
/** /**
@ -950,9 +960,12 @@ static int liquidio_stop(struct net_device *netdev)
struct octeon_device_priv *oct_priv = struct octeon_device_priv *oct_priv =
(struct octeon_device_priv *)oct->priv; (struct octeon_device_priv *)oct->priv;
struct napi_struct *napi, *n; struct napi_struct *napi, *n;
int ret = 0;
/* tell Octeon to stop forwarding packets to host */ /* tell Octeon to stop forwarding packets to host */
send_rx_ctrl_cmd(lio, 0); ret = send_rx_ctrl_cmd(lio, 0);
if (ret)
return ret;
netif_info(lio, ifdown, lio->netdev, "Stopping interface!\n"); netif_info(lio, ifdown, lio->netdev, "Stopping interface!\n");
/* Inform that netif carrier is down */ /* Inform that netif carrier is down */
@ -986,7 +999,7 @@ static int liquidio_stop(struct net_device *netdev)
dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name); dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name);
return 0; return ret;
} }
/** /**

View File

@ -548,8 +548,8 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); base = ioremap(link->resource[2]->start, resource_size(link->resource[2]));
if (!base) { if (!base) {
pcmcia_release_window(link, link->resource[2]); pcmcia_release_window(link, link->resource[2]);
return -ENOMEM; return -1;
} }
pcmcia_map_mem_page(link, link->resource[2], 0); pcmcia_map_mem_page(link, link->resource[2], 0);

View File

@ -1048,7 +1048,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) { for (i = 0; i < QLCNIC_NUM_ILB_PKT; i++) {
skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE); skb = netdev_alloc_skb(adapter->netdev, QLCNIC_ILB_PKT_SIZE);
if (!skb) if (!skb)
break; goto error;
qlcnic_create_loopback_buff(skb->data, adapter->mac_addr); qlcnic_create_loopback_buff(skb->data, adapter->mac_addr);
skb_put(skb, QLCNIC_ILB_PKT_SIZE); skb_put(skb, QLCNIC_ILB_PKT_SIZE);
adapter->ahw->diag_cnt = 0; adapter->ahw->diag_cnt = 0;
@ -1072,6 +1072,7 @@ int qlcnic_do_lb_test(struct qlcnic_adapter *adapter, u8 mode)
cnt++; cnt++;
} }
if (cnt != i) { if (cnt != i) {
error:
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"LB Test: failed, TX[%d], RX[%d]\n", i, cnt); "LB Test: failed, TX[%d], RX[%d]\n", i, cnt);
if (mode != QLCNIC_ILB_MODE) if (mode != QLCNIC_ILB_MODE)

View File

@ -30,7 +30,7 @@ struct sunxi_priv_data {
static int sun7i_gmac_init(struct platform_device *pdev, void *priv) static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
{ {
struct sunxi_priv_data *gmac = priv; struct sunxi_priv_data *gmac = priv;
int ret; int ret = 0;
if (gmac->regulator) { if (gmac->regulator) {
ret = regulator_enable(gmac->regulator); ret = regulator_enable(gmac->regulator);
@ -51,11 +51,11 @@ static int sun7i_gmac_init(struct platform_device *pdev, void *priv)
} else { } else {
clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE); clk_set_rate(gmac->tx_clk, SUN7I_GMAC_MII_RATE);
ret = clk_prepare(gmac->tx_clk); ret = clk_prepare(gmac->tx_clk);
if (ret) if (ret && gmac->regulator)
return ret; regulator_disable(gmac->regulator);
} }
return 0; return ret;
} }
static void sun7i_gmac_exit(struct platform_device *pdev, void *priv) static void sun7i_gmac_exit(struct platform_device *pdev, void *priv)

View File

@ -8144,10 +8144,10 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
"VPD_SCAN: Reading in property [%s] len[%d]\n", "VPD_SCAN: Reading in property [%s] len[%d]\n",
namebuf, prop_len); namebuf, prop_len);
for (i = 0; i < prop_len; i++) { for (i = 0; i < prop_len; i++) {
err = niu_pci_eeprom_read(np, off + i); err = niu_pci_eeprom_read(np, off + i);
if (err >= 0) if (err < 0)
*prop_buf = err; return err;
++prop_buf; *prop_buf++ = err;
} }
} }
@ -8158,14 +8158,14 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
} }
/* ESPC_PIO_EN_ENABLE must be set */ /* ESPC_PIO_EN_ENABLE must be set */
static void niu_pci_vpd_fetch(struct niu *np, u32 start) static int niu_pci_vpd_fetch(struct niu *np, u32 start)
{ {
u32 offset; u32 offset;
int err; int err;
err = niu_pci_eeprom_read16_swp(np, start + 1); err = niu_pci_eeprom_read16_swp(np, start + 1);
if (err < 0) if (err < 0)
return; return err;
offset = err + 3; offset = err + 3;
@ -8174,12 +8174,14 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start)
u32 end; u32 end;
err = niu_pci_eeprom_read(np, here); err = niu_pci_eeprom_read(np, here);
if (err < 0)
return err;
if (err != 0x90) if (err != 0x90)
return; return -EINVAL;
err = niu_pci_eeprom_read16_swp(np, here + 1); err = niu_pci_eeprom_read16_swp(np, here + 1);
if (err < 0) if (err < 0)
return; return err;
here = start + offset + 3; here = start + offset + 3;
end = start + offset + err; end = start + offset + err;
@ -8187,9 +8189,12 @@ static void niu_pci_vpd_fetch(struct niu *np, u32 start)
offset += err; offset += err;
err = niu_pci_vpd_scan_props(np, here, end); err = niu_pci_vpd_scan_props(np, here, end);
if (err < 0 || err == 1) if (err < 0)
return; return err;
if (err == 1)
return -EINVAL;
} }
return 0;
} }
/* ESPC_PIO_EN_ENABLE must be set */ /* ESPC_PIO_EN_ENABLE must be set */
@ -9280,8 +9285,11 @@ static int niu_get_invariants(struct niu *np)
offset = niu_pci_vpd_offset(np); offset = niu_pci_vpd_offset(np);
netif_printk(np, probe, KERN_DEBUG, np->dev, netif_printk(np, probe, KERN_DEBUG, np->dev,
"%s() VPD offset [%08x]\n", __func__, offset); "%s() VPD offset [%08x]\n", __func__, offset);
if (offset) if (offset) {
niu_pci_vpd_fetch(np, offset); err = niu_pci_vpd_fetch(np, offset);
if (err < 0)
return err;
}
nw64(ESPC_PIO_EN, 0); nw64(ESPC_PIO_EN, 0);
if (np->flags & NIU_FLAGS_VPD_VALID) { if (np->flags & NIU_FLAGS_VPD_VALID) {

View File

@ -1027,14 +1027,17 @@ static ssize_t ath6kl_lrssi_roam_write(struct file *file,
{ {
struct ath6kl *ar = file->private_data; struct ath6kl *ar = file->private_data;
unsigned long lrssi_roam_threshold; unsigned long lrssi_roam_threshold;
int ret;
if (kstrtoul_from_user(user_buf, count, 0, &lrssi_roam_threshold)) if (kstrtoul_from_user(user_buf, count, 0, &lrssi_roam_threshold))
return -EINVAL; return -EINVAL;
ar->lrssi_roam_threshold = lrssi_roam_threshold; ar->lrssi_roam_threshold = lrssi_roam_threshold;
ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold); ret = ath6kl_wmi_set_roam_lrssi_cmd(ar->wmi, ar->lrssi_roam_threshold);
if (ret)
return ret;
return count; return count;
} }

View File

@ -1217,13 +1217,9 @@ static struct sdio_driver brcmf_sdmmc_driver = {
}, },
}; };
void brcmf_sdio_register(void) int brcmf_sdio_register(void)
{ {
int ret; return sdio_register_driver(&brcmf_sdmmc_driver);
ret = sdio_register_driver(&brcmf_sdmmc_driver);
if (ret)
brcmf_err("sdio_register_driver failed: %d\n", ret);
} }
void brcmf_sdio_exit(void) void brcmf_sdio_exit(void)

View File

@ -275,11 +275,26 @@ void brcmf_bus_add_txhdrlen(struct device *dev, uint len);
#ifdef CONFIG_BRCMFMAC_SDIO #ifdef CONFIG_BRCMFMAC_SDIO
void brcmf_sdio_exit(void); void brcmf_sdio_exit(void);
void brcmf_sdio_register(void); int brcmf_sdio_register(void);
#else
static inline void brcmf_sdio_exit(void) { }
static inline int brcmf_sdio_register(void) { return 0; }
#endif #endif
#ifdef CONFIG_BRCMFMAC_USB #ifdef CONFIG_BRCMFMAC_USB
void brcmf_usb_exit(void); void brcmf_usb_exit(void);
void brcmf_usb_register(void); int brcmf_usb_register(void);
#else
static inline void brcmf_usb_exit(void) { }
static inline int brcmf_usb_register(void) { return 0; }
#endif
#ifdef CONFIG_BRCMFMAC_PCIE
void brcmf_pcie_exit(void);
int brcmf_pcie_register(void);
#else
static inline void brcmf_pcie_exit(void) { }
static inline int brcmf_pcie_register(void) { return 0; }
#endif #endif
#endif /* BRCMFMAC_BUS_H */ #endif /* BRCMFMAC_BUS_H */

View File

@ -1518,40 +1518,34 @@ void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state)
} }
} }
static void brcmf_driver_register(struct work_struct *work)
{
#ifdef CONFIG_BRCMFMAC_SDIO
brcmf_sdio_register();
#endif
#ifdef CONFIG_BRCMFMAC_USB
brcmf_usb_register();
#endif
#ifdef CONFIG_BRCMFMAC_PCIE
brcmf_pcie_register();
#endif
}
static DECLARE_WORK(brcmf_driver_work, brcmf_driver_register);
int __init brcmf_core_init(void) int __init brcmf_core_init(void)
{ {
if (!schedule_work(&brcmf_driver_work)) int err;
return -EBUSY;
err = brcmf_sdio_register();
if (err)
return err;
err = brcmf_usb_register();
if (err)
goto error_usb_register;
err = brcmf_pcie_register();
if (err)
goto error_pcie_register;
return 0; return 0;
error_pcie_register:
brcmf_usb_exit();
error_usb_register:
brcmf_sdio_exit();
return err;
} }
void __exit brcmf_core_exit(void) void __exit brcmf_core_exit(void)
{ {
cancel_work_sync(&brcmf_driver_work);
#ifdef CONFIG_BRCMFMAC_SDIO
brcmf_sdio_exit(); brcmf_sdio_exit();
#endif
#ifdef CONFIG_BRCMFMAC_USB
brcmf_usb_exit(); brcmf_usb_exit();
#endif
#ifdef CONFIG_BRCMFMAC_PCIE
brcmf_pcie_exit(); brcmf_pcie_exit();
#endif
} }

View File

@ -2140,15 +2140,10 @@ static struct pci_driver brcmf_pciedrvr = {
}; };
void brcmf_pcie_register(void) int brcmf_pcie_register(void)
{ {
int err;
brcmf_dbg(PCIE, "Enter\n"); brcmf_dbg(PCIE, "Enter\n");
err = pci_register_driver(&brcmf_pciedrvr); return pci_register_driver(&brcmf_pciedrvr);
if (err)
brcmf_err(NULL, "PCIE driver registration failed, err=%d\n",
err);
} }

View File

@ -11,9 +11,4 @@ struct brcmf_pciedev {
struct brcmf_pciedev_info *devinfo; struct brcmf_pciedev_info *devinfo;
}; };
void brcmf_pcie_exit(void);
void brcmf_pcie_register(void);
#endif /* BRCMFMAC_PCIE_H */ #endif /* BRCMFMAC_PCIE_H */

View File

@ -1584,12 +1584,8 @@ void brcmf_usb_exit(void)
usb_deregister(&brcmf_usbdrvr); usb_deregister(&brcmf_usbdrvr);
} }
void brcmf_usb_register(void) int brcmf_usb_register(void)
{ {
int ret;
brcmf_dbg(USB, "Enter\n"); brcmf_dbg(USB, "Enter\n");
ret = usb_register(&brcmf_usbdrvr); return usb_register(&brcmf_usbdrvr);
if (ret)
brcmf_err("usb_register failed %d\n", ret);
} }

View File

@ -801,24 +801,6 @@ static const struct attribute_group mesh_ie_group = {
.attrs = mesh_ie_attrs, .attrs = mesh_ie_attrs,
}; };
static void lbs_persist_config_init(struct net_device *dev)
{
int ret;
ret = sysfs_create_group(&(dev->dev.kobj), &boot_opts_group);
if (ret)
pr_err("failed to create boot_opts_group.\n");
ret = sysfs_create_group(&(dev->dev.kobj), &mesh_ie_group);
if (ret)
pr_err("failed to create mesh_ie_group.\n");
}
static void lbs_persist_config_remove(struct net_device *dev)
{
sysfs_remove_group(&(dev->dev.kobj), &boot_opts_group);
sysfs_remove_group(&(dev->dev.kobj), &mesh_ie_group);
}
/*************************************************************************** /***************************************************************************
* Initializing and starting, stopping mesh * Initializing and starting, stopping mesh
@ -1014,6 +996,10 @@ static int lbs_add_mesh(struct lbs_private *priv)
SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent);
mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST; mesh_dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
mesh_dev->sysfs_groups[0] = &lbs_mesh_attr_group;
mesh_dev->sysfs_groups[1] = &boot_opts_group;
mesh_dev->sysfs_groups[2] = &mesh_ie_group;
/* Register virtual mesh interface */ /* Register virtual mesh interface */
ret = register_netdev(mesh_dev); ret = register_netdev(mesh_dev);
if (ret) { if (ret) {
@ -1021,19 +1007,10 @@ static int lbs_add_mesh(struct lbs_private *priv)
goto err_free_netdev; goto err_free_netdev;
} }
ret = sysfs_create_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
if (ret)
goto err_unregister;
lbs_persist_config_init(mesh_dev);
/* Everything successful */ /* Everything successful */
ret = 0; ret = 0;
goto done; goto done;
err_unregister:
unregister_netdev(mesh_dev);
err_free_netdev: err_free_netdev:
free_netdev(mesh_dev); free_netdev(mesh_dev);
@ -1054,8 +1031,6 @@ void lbs_remove_mesh(struct lbs_private *priv)
netif_stop_queue(mesh_dev); netif_stop_queue(mesh_dev);
netif_carrier_off(mesh_dev); netif_carrier_off(mesh_dev);
sysfs_remove_group(&(mesh_dev->dev.kobj), &lbs_mesh_attr_group);
lbs_persist_config_remove(mesh_dev);
unregister_netdev(mesh_dev); unregister_netdev(mesh_dev);
priv->mesh_dev = NULL; priv->mesh_dev = NULL;
kfree(mesh_dev->ieee80211_ptr); kfree(mesh_dev->ieee80211_ptr);

View File

@ -440,9 +440,14 @@ static void rtl_watchdog_wq_callback(struct work_struct *work);
static void rtl_fwevt_wq_callback(struct work_struct *work); static void rtl_fwevt_wq_callback(struct work_struct *work);
static void rtl_c2hcmd_wq_callback(struct work_struct *work); static void rtl_c2hcmd_wq_callback(struct work_struct *work);
static void _rtl_init_deferred_work(struct ieee80211_hw *hw) static int _rtl_init_deferred_work(struct ieee80211_hw *hw)
{ {
struct rtl_priv *rtlpriv = rtl_priv(hw); struct rtl_priv *rtlpriv = rtl_priv(hw);
struct workqueue_struct *wq;
wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name);
if (!wq)
return -ENOMEM;
/* <1> timer */ /* <1> timer */
timer_setup(&rtlpriv->works.watchdog_timer, timer_setup(&rtlpriv->works.watchdog_timer,
@ -451,11 +456,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtl_easy_concurrent_retrytimer_callback, 0); rtl_easy_concurrent_retrytimer_callback, 0);
/* <2> work queue */ /* <2> work queue */
rtlpriv->works.hw = hw; rtlpriv->works.hw = hw;
rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); rtlpriv->works.rtl_wq = wq;
if (unlikely(!rtlpriv->works.rtl_wq)) {
pr_err("Failed to allocate work queue\n");
return;
}
INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq,
rtl_watchdog_wq_callback); rtl_watchdog_wq_callback);
@ -466,6 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw)
rtl_swlps_rfon_wq_callback); rtl_swlps_rfon_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.fwevt_wq, rtl_fwevt_wq_callback);
INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback); INIT_DELAYED_WORK(&rtlpriv->works.c2hcmd_wq, rtl_c2hcmd_wq_callback);
return 0;
} }
void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq) void rtl_deinit_deferred_work(struct ieee80211_hw *hw, bool ips_wq)
@ -564,9 +566,7 @@ int rtl_init_core(struct ieee80211_hw *hw)
rtlmac->link_state = MAC80211_NOLINK; rtlmac->link_state = MAC80211_NOLINK;
/* <6> init deferred work */ /* <6> init deferred work */
_rtl_init_deferred_work(hw); return _rtl_init_deferred_work(hw);
return 0;
} }
EXPORT_SYMBOL_GPL(rtl_init_core); EXPORT_SYMBOL_GPL(rtl_init_core);

View File

@ -2127,6 +2127,14 @@ static int riocm_add_mport(struct device *dev,
return -ENODEV; return -ENODEV;
} }
cm->rx_wq = create_workqueue(DRV_NAME "/rxq");
if (!cm->rx_wq) {
rio_release_inb_mbox(mport, cmbox);
rio_release_outb_mbox(mport, cmbox);
kfree(cm);
return -ENOMEM;
}
/* /*
* Allocate and register inbound messaging buffers to be ready * Allocate and register inbound messaging buffers to be ready
* to receive channel and system management requests * to receive channel and system management requests
@ -2137,15 +2145,6 @@ static int riocm_add_mport(struct device *dev,
cm->rx_slots = RIOCM_RX_RING_SIZE; cm->rx_slots = RIOCM_RX_RING_SIZE;
mutex_init(&cm->rx_lock); mutex_init(&cm->rx_lock);
riocm_rx_fill(cm, RIOCM_RX_RING_SIZE); riocm_rx_fill(cm, RIOCM_RX_RING_SIZE);
cm->rx_wq = create_workqueue(DRV_NAME "/rxq");
if (!cm->rx_wq) {
riocm_error("failed to allocate IBMBOX_%d on %s",
cmbox, mport->name);
rio_release_outb_mbox(mport, cmbox);
kfree(cm);
return -ENOMEM;
}
INIT_WORK(&cm->rx_work, rio_ibmsg_handler); INIT_WORK(&cm->rx_work, rio_ibmsg_handler);
cm->tx_slot = 0; cm->tx_slot = 0;

View File

@ -467,21 +467,24 @@ static int ufs_hisi_init_common(struct ufs_hba *hba)
host->hba = hba; host->hba = hba;
ufshcd_set_variant(hba, host); ufshcd_set_variant(hba, host);
host->rst = devm_reset_control_get(dev, "rst"); host->rst = devm_reset_control_get(dev, "rst");
if (IS_ERR(host->rst)) { if (IS_ERR(host->rst)) {
dev_err(dev, "%s: failed to get reset control\n", __func__); dev_err(dev, "%s: failed to get reset control\n", __func__);
return PTR_ERR(host->rst); err = PTR_ERR(host->rst);
goto error;
} }
ufs_hisi_set_pm_lvl(hba); ufs_hisi_set_pm_lvl(hba);
err = ufs_hisi_get_resource(host); err = ufs_hisi_get_resource(host);
if (err) { if (err)
ufshcd_set_variant(hba, NULL); goto error;
return err;
}
return 0; return 0;
error:
ufshcd_set_variant(hba, NULL);
return err;
} }
static int ufs_hi3660_init(struct ufs_hba *hba) static int ufs_hi3660_init(struct ufs_hba *hba)

View File

@ -1519,6 +1519,8 @@ static int __init max310x_uart_init(void)
#ifdef CONFIG_SPI_MASTER #ifdef CONFIG_SPI_MASTER
ret = spi_register_driver(&max310x_spi_driver); ret = spi_register_driver(&max310x_spi_driver);
if (ret)
uart_unregister_driver(&max310x_uart);
#endif #endif
return ret; return ret;

View File

@ -818,9 +818,6 @@ static int mvebu_uart_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
if (!match)
return -ENODEV;
/* Assume that all UART ports have a DT alias or none has */ /* Assume that all UART ports have a DT alias or none has */
id = of_alias_get_id(pdev->dev.of_node, "serial"); id = of_alias_get_id(pdev->dev.of_node, "serial");
if (!pdev->dev.of_node || id < 0) if (!pdev->dev.of_node || id < 0)

View File

@ -291,13 +291,15 @@ hv_uio_probe(struct hv_device *dev,
pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE); pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE);
if (pdata->recv_buf == NULL) { if (pdata->recv_buf == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail_close; goto fail_free_ring;
} }
ret = vmbus_establish_gpadl(channel, pdata->recv_buf, ret = vmbus_establish_gpadl(channel, pdata->recv_buf,
RECV_BUFFER_SIZE, &pdata->recv_gpadl); RECV_BUFFER_SIZE, &pdata->recv_gpadl);
if (ret) if (ret) {
vfree(pdata->recv_buf);
goto fail_close; goto fail_close;
}
/* put Global Physical Address Label in name */ /* put Global Physical Address Label in name */
snprintf(pdata->recv_name, sizeof(pdata->recv_name), snprintf(pdata->recv_name, sizeof(pdata->recv_name),
@ -316,8 +318,10 @@ hv_uio_probe(struct hv_device *dev,
ret = vmbus_establish_gpadl(channel, pdata->send_buf, ret = vmbus_establish_gpadl(channel, pdata->send_buf,
SEND_BUFFER_SIZE, &pdata->send_gpadl); SEND_BUFFER_SIZE, &pdata->send_gpadl);
if (ret) if (ret) {
vfree(pdata->send_buf);
goto fail_close; goto fail_close;
}
snprintf(pdata->send_name, sizeof(pdata->send_name), snprintf(pdata->send_name, sizeof(pdata->send_name),
"send:%u", pdata->send_gpadl); "send:%u", pdata->send_gpadl);
@ -347,6 +351,8 @@ hv_uio_probe(struct hv_device *dev,
fail_close: fail_close:
hv_uio_cleanup(dev, pdata); hv_uio_cleanup(dev, pdata);
fail_free_ring:
vmbus_free_ring(dev->channel);
return ret; return ret;
} }

View File

@ -82,7 +82,7 @@ static int probe(struct pci_dev *pdev,
} }
if (pdev->irq && !pci_intx_mask_supported(pdev)) if (pdev->irq && !pci_intx_mask_supported(pdev))
return -ENOMEM; return -ENODEV;
gdev = devm_kzalloc(&pdev->dev, sizeof(struct uio_pci_generic_dev), GFP_KERNEL); gdev = devm_kzalloc(&pdev->dev, sizeof(struct uio_pci_generic_dev), GFP_KERNEL);
if (!gdev) if (!gdev)

View File

@ -286,7 +286,7 @@ static int hga_card_detect(void)
hga_vram = ioremap(0xb0000, hga_vram_len); hga_vram = ioremap(0xb0000, hga_vram_len);
if (!hga_vram) if (!hga_vram)
goto error; return -ENOMEM;
if (request_region(0x3b0, 12, "hgafb")) if (request_region(0x3b0, 12, "hgafb"))
release_io_ports = 1; release_io_ports = 1;
@ -346,13 +346,18 @@ static int hga_card_detect(void)
hga_type_name = "Hercules"; hga_type_name = "Hercules";
break; break;
} }
return 1; return 0;
error: error:
if (release_io_ports) if (release_io_ports)
release_region(0x3b0, 12); release_region(0x3b0, 12);
if (release_io_port) if (release_io_port)
release_region(0x3bf, 1); release_region(0x3bf, 1);
return 0;
iounmap(hga_vram);
pr_err("hgafb: HGA card not detected.\n");
return -EINVAL;
} }
/** /**
@ -550,13 +555,11 @@ static const struct fb_ops hgafb_ops = {
static int hgafb_probe(struct platform_device *pdev) static int hgafb_probe(struct platform_device *pdev)
{ {
struct fb_info *info; struct fb_info *info;
int ret;
if (! hga_card_detect()) { ret = hga_card_detect();
printk(KERN_INFO "hgafb: HGA card not detected.\n"); if (!ret)
if (hga_vram) return ret;
iounmap(hga_vram);
return -EINVAL;
}
printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n", printk(KERN_INFO "hgafb: %s with %ldK of memory detected.\n",
hga_type_name, hga_vram_len/1024); hga_type_name, hga_vram_len/1024);

View File

@ -1469,6 +1469,7 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
struct imstt_par *par; struct imstt_par *par;
struct fb_info *info; struct fb_info *info;
struct device_node *dp; struct device_node *dp;
int ret = -ENOMEM;
dp = pci_device_to_OF_node(pdev); dp = pci_device_to_OF_node(pdev);
if(dp) if(dp)
@ -1504,28 +1505,37 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
default: default:
printk(KERN_INFO "imsttfb: Device 0x%x unknown, " printk(KERN_INFO "imsttfb: Device 0x%x unknown, "
"contact maintainer.\n", pdev->device); "contact maintainer.\n", pdev->device);
release_mem_region(addr, size); ret = -ENODEV;
framebuffer_release(info); goto error;
return -ENODEV;
} }
info->fix.smem_start = addr; info->fix.smem_start = addr;
info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ? info->screen_base = (__u8 *)ioremap(addr, par->ramdac == IBM ?
0x400000 : 0x800000); 0x400000 : 0x800000);
if (!info->screen_base) { if (!info->screen_base)
release_mem_region(addr, size); goto error;
framebuffer_release(info);
return -ENOMEM;
}
info->fix.mmio_start = addr + 0x800000; info->fix.mmio_start = addr + 0x800000;
par->dc_regs = ioremap(addr + 0x800000, 0x1000); par->dc_regs = ioremap(addr + 0x800000, 0x1000);
if (!par->dc_regs)
goto error;
par->cmap_regs_phys = addr + 0x840000; par->cmap_regs_phys = addr + 0x840000;
par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000); par->cmap_regs = (__u8 *)ioremap(addr + 0x840000, 0x1000);
if (!par->cmap_regs)
goto error;
info->pseudo_palette = par->palette; info->pseudo_palette = par->palette;
init_imstt(info); init_imstt(info);
pci_set_drvdata(pdev, info); pci_set_drvdata(pdev, info);
return 0; return 0;
error:
if (par->dc_regs)
iounmap(par->dc_regs);
if (info->screen_base)
iounmap(info->screen_base);
release_mem_region(addr, size);
framebuffer_release(info);
return ret;
} }
static void imsttfb_remove(struct pci_dev *pdev) static void imsttfb_remove(struct pci_dev *pdev)

View File

@ -296,10 +296,6 @@ static int crypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,
struct extent_crypt_result ecr; struct extent_crypt_result ecr;
int rc = 0; int rc = 0;
if (!crypt_stat || !crypt_stat->tfm
|| !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED))
return -EINVAL;
if (unlikely(ecryptfs_verbosity > 0)) { if (unlikely(ecryptfs_verbosity > 0)) {
ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n", ecryptfs_printk(KERN_DEBUG, "Key size [%zd]; key:\n",
crypt_stat->key_size); crypt_stat->key_size);

View File

@ -32,6 +32,11 @@ struct _ddebug {
#define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2)
#define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_LINENO (1<<3)
#define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_TID (1<<4)
#define _DPRINTK_FLAGS_INCL_ANY \
(_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\
_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID)
#if defined DEBUG #if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT #define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else #else

View File

@ -239,6 +239,39 @@ enum gaudi_engine_id {
GAUDI_ENGINE_ID_SIZE GAUDI_ENGINE_ID_SIZE
}; };
/*
* ASIC specific PLL index
*
* Used to retrieve in frequency info of different IPs via
* HL_INFO_PLL_FREQUENCY under HL_IOCTL_INFO IOCTL. The enums need to be
* used as an index in struct hl_pll_frequency_info
*/
enum hl_goya_pll_index {
HL_GOYA_CPU_PLL = 0,
HL_GOYA_IC_PLL,
HL_GOYA_MC_PLL,
HL_GOYA_MME_PLL,
HL_GOYA_PCI_PLL,
HL_GOYA_EMMC_PLL,
HL_GOYA_TPC_PLL,
HL_GOYA_PLL_MAX
};
enum hl_gaudi_pll_index {
HL_GAUDI_CPU_PLL = 0,
HL_GAUDI_PCI_PLL,
HL_GAUDI_SRAM_PLL,
HL_GAUDI_HBM_PLL,
HL_GAUDI_NIC_PLL,
HL_GAUDI_DMA_PLL,
HL_GAUDI_MESH_PLL,
HL_GAUDI_MME_PLL,
HL_GAUDI_TPC_PLL,
HL_GAUDI_IF_PLL,
HL_GAUDI_PLL_MAX
};
enum hl_device_status { enum hl_device_status {
HL_DEVICE_STATUS_OPERATIONAL, HL_DEVICE_STATUS_OPERATIONAL,
HL_DEVICE_STATUS_IN_RESET, HL_DEVICE_STATUS_IN_RESET,

View File

@ -586,13 +586,11 @@ static int remaining(int wrote)
return 0; return 0;
} }
static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf) static char *__dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
{ {
int pos_after_tid; int pos_after_tid;
int pos = 0; int pos = 0;
*buf = '\0';
if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
if (in_interrupt()) if (in_interrupt())
pos += snprintf(buf + pos, remaining(pos), "<intr> "); pos += snprintf(buf + pos, remaining(pos), "<intr> ");
@ -618,11 +616,18 @@ static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
return buf; return buf;
} }
static inline char *dynamic_emit_prefix(struct _ddebug *desc, char *buf)
{
if (unlikely(desc->flags & _DPRINTK_FLAGS_INCL_ANY))
return __dynamic_emit_prefix(desc, buf);
return buf;
}
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...) void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
{ {
va_list args; va_list args;
struct va_format vaf; struct va_format vaf;
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE] = "";
BUG_ON(!descriptor); BUG_ON(!descriptor);
BUG_ON(!fmt); BUG_ON(!fmt);
@ -655,7 +660,7 @@ void __dynamic_dev_dbg(struct _ddebug *descriptor,
if (!dev) { if (!dev) {
printk(KERN_DEBUG "(NULL device *): %pV", &vaf); printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
} else { } else {
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE] = "";
dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV", dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV",
dynamic_emit_prefix(descriptor, buf), dynamic_emit_prefix(descriptor, buf),
@ -684,7 +689,7 @@ void __dynamic_netdev_dbg(struct _ddebug *descriptor,
vaf.va = &args; vaf.va = &args;
if (dev && dev->dev.parent) { if (dev && dev->dev.parent) {
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE] = "";
dev_printk_emit(LOGLEVEL_DEBUG, dev->dev.parent, dev_printk_emit(LOGLEVEL_DEBUG, dev->dev.parent,
"%s%s %s %s%s: %pV", "%s%s %s %s%s: %pV",
@ -720,7 +725,7 @@ void __dynamic_ibdev_dbg(struct _ddebug *descriptor,
vaf.va = &args; vaf.va = &args;
if (ibdev && ibdev->dev.parent) { if (ibdev && ibdev->dev.parent) {
char buf[PREFIX_SIZE]; char buf[PREFIX_SIZE] = "";
dev_printk_emit(LOGLEVEL_DEBUG, ibdev->dev.parent, dev_printk_emit(LOGLEVEL_DEBUG, ibdev->dev.parent,
"%s%s %s %s: %pV", "%s%s %s %s: %pV",
@ -915,7 +920,6 @@ static const struct seq_operations ddebug_proc_seqops = {
static int ddebug_proc_open(struct inode *inode, struct file *file) static int ddebug_proc_open(struct inode *inode, struct file *file)
{ {
vpr_info("called\n");
return seq_open_private(file, &ddebug_proc_seqops, return seq_open_private(file, &ddebug_proc_seqops,
sizeof(struct ddebug_iter)); sizeof(struct ddebug_iter));
} }

View File

@ -402,6 +402,14 @@ struct smcd_dev *smcd_alloc_dev(struct device *parent, const char *name,
return NULL; return NULL;
} }
smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)",
WQ_MEM_RECLAIM, name);
if (!smcd->event_wq) {
kfree(smcd->conn);
kfree(smcd);
return NULL;
}
smcd->dev.parent = parent; smcd->dev.parent = parent;
smcd->dev.release = smcd_release; smcd->dev.release = smcd_release;
device_initialize(&smcd->dev); device_initialize(&smcd->dev);
@ -415,13 +423,6 @@ struct smcd_dev *smcd_alloc_dev(struct device *parent, const char *name,
INIT_LIST_HEAD(&smcd->vlan); INIT_LIST_HEAD(&smcd->vlan);
INIT_LIST_HEAD(&smcd->lgr_list); INIT_LIST_HEAD(&smcd->lgr_list);
init_waitqueue_head(&smcd->lgrs_deleted); init_waitqueue_head(&smcd->lgrs_deleted);
smcd->event_wq = alloc_ordered_workqueue("ism_evt_wq-%s)",
WQ_MEM_RECLAIM, name);
if (!smcd->event_wq) {
kfree(smcd->conn);
kfree(smcd);
return NULL;
}
return smcd; return smcd;
} }
EXPORT_SYMBOL_GPL(smcd_alloc_dev); EXPORT_SYMBOL_GPL(smcd_alloc_dev);

View File

@ -77,17 +77,8 @@ static const struct snd_kcontrol_new snd_gus_joystick_control = {
static void snd_gus_init_control(struct snd_gus_card *gus) static void snd_gus_init_control(struct snd_gus_card *gus)
{ {
int ret; if (!gus->ace_flag)
snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus));
if (!gus->ace_flag) {
ret =
snd_ctl_add(gus->card,
snd_ctl_new1(&snd_gus_joystick_control,
gus));
if (ret)
snd_printk(KERN_ERR "gus: snd_ctl_add failed: %d\n",
ret);
}
} }
/* /*

View File

@ -846,14 +846,10 @@ int snd_sb16dsp_pcm(struct snd_sb *chip, int device)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops);
if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) { if (chip->dma16 >= 0 && chip->dma8 != chip->dma16)
err = snd_ctl_add(card, snd_ctl_new1( snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip));
&snd_sb16_dma_control, chip)); else
if (err)
return err;
} else {
pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
}
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
card->dev, 64*1024, 128*1024); card->dev, 64*1024, 128*1024);

View File

@ -93,12 +93,12 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
acard = card->private_data; acard = card->private_data;
card->private_free = snd_sb8_free; card->private_free = snd_sb8_free;
/* block the 0x388 port to avoid PnP conflicts */ /*
* Block the 0x388 port to avoid PnP conflicts.
* No need to check this value after request_region,
* as we never do anything with it.
*/
acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
if (!acard->fm_res) {
err = -EBUSY;
goto _err;
}
if (port[dev] != SNDRV_AUTO_PORT) { if (port[dev] != SNDRV_AUTO_PORT) {
if ((err = snd_sbdsp_create(card, port[dev], irq[dev], if ((err = snd_sbdsp_create(card, port[dev], irq[dev],

View File

@ -1735,6 +1735,14 @@ static DEVICE_ATTR(hpload_dc_r, 0444, cs43130_show_dc_r, NULL);
static DEVICE_ATTR(hpload_ac_l, 0444, cs43130_show_ac_l, NULL); static DEVICE_ATTR(hpload_ac_l, 0444, cs43130_show_ac_l, NULL);
static DEVICE_ATTR(hpload_ac_r, 0444, cs43130_show_ac_r, NULL); static DEVICE_ATTR(hpload_ac_r, 0444, cs43130_show_ac_r, NULL);
static struct attribute *hpload_attrs[] = {
&dev_attr_hpload_dc_l.attr,
&dev_attr_hpload_dc_r.attr,
&dev_attr_hpload_ac_l.attr,
&dev_attr_hpload_ac_r.attr,
};
ATTRIBUTE_GROUPS(hpload);
static struct reg_sequence hp_en_cal_seq[] = { static struct reg_sequence hp_en_cal_seq[] = {
{CS43130_INT_MASK_4, CS43130_INT_MASK_ALL}, {CS43130_INT_MASK_4, CS43130_INT_MASK_ALL},
{CS43130_HP_MEAS_LOAD_1, 0}, {CS43130_HP_MEAS_LOAD_1, 0},
@ -2302,25 +2310,15 @@ static int cs43130_probe(struct snd_soc_component *component)
cs43130->hpload_done = false; cs43130->hpload_done = false;
if (cs43130->dc_meas) { if (cs43130->dc_meas) {
ret = device_create_file(component->dev, &dev_attr_hpload_dc_l); ret = sysfs_create_groups(&component->dev->kobj, hpload_groups);
if (ret < 0) if (ret)
return ret;
ret = device_create_file(component->dev, &dev_attr_hpload_dc_r);
if (ret < 0)
return ret;
ret = device_create_file(component->dev, &dev_attr_hpload_ac_l);
if (ret < 0)
return ret;
ret = device_create_file(component->dev, &dev_attr_hpload_ac_r);
if (ret < 0)
return ret; return ret;
cs43130->wq = create_singlethread_workqueue("cs43130_hp"); cs43130->wq = create_singlethread_workqueue("cs43130_hp");
if (!cs43130->wq) if (!cs43130->wq) {
sysfs_remove_groups(&component->dev->kobj, hpload_groups);
return -ENOMEM; return -ENOMEM;
}
INIT_WORK(&cs43130->work, cs43130_imp_meas); INIT_WORK(&cs43130->work, cs43130_imp_meas);
} }

View File

@ -3388,30 +3388,44 @@ static int rt5645_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component); struct rt5645_priv *rt5645 = snd_soc_component_get_drvdata(component);
int ret = 0;
rt5645->component = component; rt5645->component = component;
switch (rt5645->codec_type) { switch (rt5645->codec_type) {
case CODEC_TYPE_RT5645: case CODEC_TYPE_RT5645:
snd_soc_dapm_new_controls(dapm, ret = snd_soc_dapm_new_controls(dapm,
rt5645_specific_dapm_widgets, rt5645_specific_dapm_widgets,
ARRAY_SIZE(rt5645_specific_dapm_widgets)); ARRAY_SIZE(rt5645_specific_dapm_widgets));
snd_soc_dapm_add_routes(dapm, if (ret < 0)
goto exit;
ret = snd_soc_dapm_add_routes(dapm,
rt5645_specific_dapm_routes, rt5645_specific_dapm_routes,
ARRAY_SIZE(rt5645_specific_dapm_routes)); ARRAY_SIZE(rt5645_specific_dapm_routes));
if (ret < 0)
goto exit;
if (rt5645->v_id < 3) { if (rt5645->v_id < 3) {
snd_soc_dapm_add_routes(dapm, ret = snd_soc_dapm_add_routes(dapm,
rt5645_old_dapm_routes, rt5645_old_dapm_routes,
ARRAY_SIZE(rt5645_old_dapm_routes)); ARRAY_SIZE(rt5645_old_dapm_routes));
if (ret < 0)
goto exit;
} }
break; break;
case CODEC_TYPE_RT5650: case CODEC_TYPE_RT5650:
snd_soc_dapm_new_controls(dapm, ret = snd_soc_dapm_new_controls(dapm,
rt5650_specific_dapm_widgets, rt5650_specific_dapm_widgets,
ARRAY_SIZE(rt5650_specific_dapm_widgets)); ARRAY_SIZE(rt5650_specific_dapm_widgets));
snd_soc_dapm_add_routes(dapm, if (ret < 0)
goto exit;
ret = snd_soc_dapm_add_routes(dapm,
rt5650_specific_dapm_routes, rt5650_specific_dapm_routes,
ARRAY_SIZE(rt5650_specific_dapm_routes)); ARRAY_SIZE(rt5650_specific_dapm_routes));
if (ret < 0)
goto exit;
break; break;
} }
@ -3419,9 +3433,17 @@ static int rt5645_probe(struct snd_soc_component *component)
/* for JD function */ /* for JD function */
if (rt5645->pdata.jd_mode) { if (rt5645->pdata.jd_mode) {
snd_soc_dapm_force_enable_pin(dapm, "JD Power"); ret = snd_soc_dapm_force_enable_pin(dapm, "JD Power");
snd_soc_dapm_force_enable_pin(dapm, "LDO2"); if (ret < 0)
snd_soc_dapm_sync(dapm); goto exit;
ret = snd_soc_dapm_force_enable_pin(dapm, "LDO2");
if (ret < 0)
goto exit;
ret = snd_soc_dapm_sync(dapm);
if (ret < 0)
goto exit;
} }
if (rt5645->pdata.long_name) if (rt5645->pdata.long_name)
@ -3432,9 +3454,14 @@ static int rt5645_probe(struct snd_soc_component *component)
GFP_KERNEL); GFP_KERNEL);
if (!rt5645->eq_param) if (!rt5645->eq_param)
return -ENOMEM; ret = -ENOMEM;
exit:
return 0; /*
* If there was an error above, everything will be cleaned up by the
* caller if we return an error here. This will be done with a later
* call to rt5645_remove().
*/
return ret;
} }
static void rt5645_remove(struct snd_soc_component *component) static void rt5645_remove(struct snd_soc_component *component)