diff options
author | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2017-08-18 10:57:35 -0400 |
---|---|---|
committer | Alexander Shishkin <alexander.shishkin@linux.intel.com> | 2017-08-25 11:47:59 -0400 |
commit | 3321371b5d648479058fa6f9441168abbc1467c9 (patch) | |
tree | df748323a68aa5b74d8daa0c31149511b73fc290 /drivers/hwtracing/intel_th | |
parent | efb3669e14fe17d0ec4ecf57d0365039fe726f59 (diff) |
intel_th: pci: Use drvdata for quirks
Allow attaching miscellaneous quirk information to devices as drvdata.
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Diffstat (limited to 'drivers/hwtracing/intel_th')
-rw-r--r-- | drivers/hwtracing/intel_th/core.c | 6 | ||||
-rw-r--r-- | drivers/hwtracing/intel_th/intel_th.h | 27 | ||||
-rw-r--r-- | drivers/hwtracing/intel_th/pci.c | 3 |
3 files changed, 26 insertions, 10 deletions
diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c index d1760003b4a4..e915ab24f434 100644 --- a/drivers/hwtracing/intel_th/core.c +++ b/drivers/hwtracing/intel_th/core.c | |||
@@ -576,6 +576,7 @@ intel_th_subdevice_alloc(struct intel_th *th, | |||
576 | if (!thdev) | 576 | if (!thdev) |
577 | return ERR_PTR(-ENOMEM); | 577 | return ERR_PTR(-ENOMEM); |
578 | 578 | ||
579 | thdev->drvdata = th->drvdata; | ||
579 | 580 | ||
580 | memcpy(res, subdev->res, | 581 | memcpy(res, subdev->res, |
581 | sizeof(struct resource) * subdev->nres); | 582 | sizeof(struct resource) * subdev->nres); |
@@ -789,8 +790,8 @@ static const struct file_operations intel_th_output_fops = { | |||
789 | * @irq: irq number | 790 | * @irq: irq number |
790 | */ | 791 | */ |
791 | struct intel_th * | 792 | struct intel_th * |
792 | intel_th_alloc(struct device *dev, struct resource *devres, | 793 | intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, |
793 | unsigned int ndevres, int irq) | 794 | struct resource *devres, unsigned int ndevres, int irq) |
794 | { | 795 | { |
795 | struct intel_th *th; | 796 | struct intel_th *th; |
796 | int err; | 797 | int err; |
@@ -812,6 +813,7 @@ intel_th_alloc(struct device *dev, struct resource *devres, | |||
812 | goto err_ida; | 813 | goto err_ida; |
813 | } | 814 | } |
814 | th->dev = dev; | 815 | th->dev = dev; |
816 | th->drvdata = drvdata; | ||
815 | 817 | ||
816 | th->resource = devres; | 818 | th->resource = devres; |
817 | th->num_resources = ndevres; | 819 | th->num_resources = ndevres; |
diff --git a/drivers/hwtracing/intel_th/intel_th.h b/drivers/hwtracing/intel_th/intel_th.h index 3f4558404dca..68244602ca29 100644 --- a/drivers/hwtracing/intel_th/intel_th.h +++ b/drivers/hwtracing/intel_th/intel_th.h | |||
@@ -48,8 +48,19 @@ struct intel_th_output { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * struct intel_th_drvdata - describes hardware capabilities and quirks | ||
52 | * @tscu_enable: device needs SW to enable time stamping unit | ||
53 | */ | ||
54 | struct intel_th_drvdata { | ||
55 | unsigned int tscu_enable : 1; | ||
56 | }; | ||
57 | |||
58 | #define INTEL_TH_CAP(_th, _cap) ((_th)->drvdata ? (_th)->drvdata->_cap : 0) | ||
59 | |||
60 | /** | ||
51 | * struct intel_th_device - device on the intel_th bus | 61 | * struct intel_th_device - device on the intel_th bus |
52 | * @dev: device | 62 | * @dev: device |
63 | * @drvdata: hardware capabilities/quirks | ||
53 | * @resource: array of resources available to this device | 64 | * @resource: array of resources available to this device |
54 | * @num_resources: number of resources in @resource array | 65 | * @num_resources: number of resources in @resource array |
55 | * @type: INTEL_TH_{SOURCE,OUTPUT,SWITCH} | 66 | * @type: INTEL_TH_{SOURCE,OUTPUT,SWITCH} |
@@ -59,11 +70,12 @@ struct intel_th_output { | |||
59 | * @name: device name to match the driver | 70 | * @name: device name to match the driver |
60 | */ | 71 | */ |
61 | struct intel_th_device { | 72 | struct intel_th_device { |
62 | struct device dev; | 73 | struct device dev; |
63 | struct resource *resource; | 74 | struct intel_th_drvdata *drvdata; |
64 | unsigned int num_resources; | 75 | struct resource *resource; |
65 | unsigned int type; | 76 | unsigned int num_resources; |
66 | int id; | 77 | unsigned int type; |
78 | int id; | ||
67 | 79 | ||
68 | /* INTEL_TH_SWITCH specific */ | 80 | /* INTEL_TH_SWITCH specific */ |
69 | bool host_mode; | 81 | bool host_mode; |
@@ -206,8 +218,8 @@ static inline struct intel_th *to_intel_th(struct intel_th_device *thdev) | |||
206 | } | 218 | } |
207 | 219 | ||
208 | struct intel_th * | 220 | struct intel_th * |
209 | intel_th_alloc(struct device *dev, struct resource *devres, | 221 | intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata, |
210 | unsigned int ndevres, int irq); | 222 | struct resource *devres, unsigned int ndevres, int irq); |
211 | void intel_th_free(struct intel_th *th); | 223 | void intel_th_free(struct intel_th *th); |
212 | 224 | ||
213 | int intel_th_driver_register(struct intel_th_driver *thdrv); | 225 | int intel_th_driver_register(struct intel_th_driver *thdrv); |
@@ -248,6 +260,7 @@ struct intel_th { | |||
248 | 260 | ||
249 | struct intel_th_device *thdev[TH_SUBDEVICE_MAX]; | 261 | struct intel_th_device *thdev[TH_SUBDEVICE_MAX]; |
250 | struct intel_th_device *hub; | 262 | struct intel_th_device *hub; |
263 | struct intel_th_drvdata *drvdata; | ||
251 | 264 | ||
252 | struct resource *resource; | 265 | struct resource *resource; |
253 | unsigned int num_thdevs; | 266 | unsigned int num_thdevs; |
diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/pci.c index 5a9a9e8072a9..aed6d594991e 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c | |||
@@ -30,6 +30,7 @@ | |||
30 | static int intel_th_pci_probe(struct pci_dev *pdev, | 30 | static int intel_th_pci_probe(struct pci_dev *pdev, |
31 | const struct pci_device_id *id) | 31 | const struct pci_device_id *id) |
32 | { | 32 | { |
33 | struct intel_th_drvdata *drvdata = (void *)id->driver_data; | ||
33 | struct intel_th *th; | 34 | struct intel_th *th; |
34 | int err; | 35 | int err; |
35 | 36 | ||
@@ -41,7 +42,7 @@ static int intel_th_pci_probe(struct pci_dev *pdev, | |||
41 | if (err) | 42 | if (err) |
42 | return err; | 43 | return err; |
43 | 44 | ||
44 | th = intel_th_alloc(&pdev->dev, pdev->resource, | 45 | th = intel_th_alloc(&pdev->dev, drvdata, pdev->resource, |
45 | DEVICE_COUNT_RESOURCE, pdev->irq); | 46 | DEVICE_COUNT_RESOURCE, pdev->irq); |
46 | if (IS_ERR(th)) | 47 | if (IS_ERR(th)) |
47 | return PTR_ERR(th); | 48 | return PTR_ERR(th); |