Skip to content

Commit

Permalink
Delete scd_resource_len() from scd driver
Browse files Browse the repository at this point in the history
Now we pass resource len as second parameter of scd_ext_ops::probe() func

Change-Id: Id3461b1be904df7728711872d1fb9dae3cbe787d
  • Loading branch information
yurypm committed Jul 25, 2018
1 parent 9d4656b commit f9645f3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/scd-hwmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ static ssize_t smbus_tweaks(struct device *dev, struct device_attribute *attr,

static DEVICE_ATTR(smbus_tweaks, S_IRUGO|S_IWUSR|S_IWGRP, 0, smbus_tweaks);

static int scd_ext_hwmon_probe(struct pci_dev *pdev)
static int scd_ext_hwmon_probe(struct pci_dev *pdev, size_t mem_len)
{
struct scd_context *ctx = get_context_for_pdev(pdev);
int err;
Expand All @@ -1525,7 +1525,7 @@ static int scd_ext_hwmon_probe(struct pci_dev *pdev)
ctx->initialized = false;
mutex_init(&ctx->mutex);

ctx->res_size = scd_resource_len(pdev);
ctx->res_size = mem_len;

INIT_LIST_HEAD(&ctx->led_list);
INIT_LIST_HEAD(&ctx->master_list);
Expand Down
18 changes: 2 additions & 16 deletions src/scd.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int scd_register_ext_ops(struct scd_ext_ops *ops) {
// call probe() for any existing scd
list_for_each_entry(priv, &scd_list, list) {
if (scd_ext_ops->probe) {
scd_ext_ops->probe(priv->pdev);
scd_ext_ops->probe(priv->pdev, priv->mem_len);
}
}
scd_unlock();
Expand Down Expand Up @@ -918,20 +918,6 @@ scd_write_register(struct pci_dev *pdev, u32 offset, u32 val)
}
EXPORT_SYMBOL(scd_write_register);

size_t
scd_resource_len(struct pci_dev *pdev)
{
struct scd_dev_priv *priv;

priv = pci_get_drvdata(pdev);
ASSERT( priv );
if (priv)
return priv->mem_len;

return 0;
}
EXPORT_SYMBOL(scd_resource_len);

// scd_list_lock mutex is not held in this function.
// scd_lock mutex is not held in this function.
u64
Expand Down Expand Up @@ -1335,7 +1321,7 @@ static int scd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
scd_lock();
list_add_tail(&priv->list, &scd_list);
if (scd_ext_ops && scd_ext_ops->probe) {
scd_ext_ops->probe(priv->pdev);
scd_ext_ops->probe(priv->pdev, priv->mem_len);
}
scd_unlock();

Expand Down
3 changes: 1 addition & 2 deletions src/scd.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct scd_em_ops {

// Allow scd-ext callbacks to be registered
struct scd_ext_ops {
int (*probe)(struct pci_dev *pdev);
int (*probe)(struct pci_dev *pdev, size_t mem_len);
void (*remove)(struct pci_dev *pdev);
int (*finish_init)(struct pci_dev *pdev);
};
Expand All @@ -55,7 +55,6 @@ void scd_unregister_ext_ops(void);
struct pci_dev *scd_get_pdev(const char *name);
u32 scd_read_register(struct pci_dev *pdev, u32 offset);
void scd_write_register(struct pci_dev *pdev, u32 offset, u32 val);
size_t scd_resource_len(struct pci_dev *pdev);
u64 scd_ptp_timestamp(void);

// Copyright (c) 2010-2016 Arista Networks, Inc. All rights reserved.
Expand Down

0 comments on commit f9645f3

Please sign in to comment.