goldfish: pipe: ANDROID: rename global variables
We don't need an array of 1 for pipe_dev and use better names to distinguish between goldfish_pipe_dev and miscdevice. Bug: 72717639 Bug: 66884503 Change-Id: Iab040c158745f034ca8e9569fd49c84933b1c4ba Signed-off-by: Roman Kiryanov <rkir@google.com>
This commit is contained in:
parent
d176c57751
commit
9846d12d48
3 changed files with 22 additions and 20 deletions
|
@ -506,7 +506,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id)
|
||||||
static int goldfish_pipe_open(struct inode *inode, struct file *file)
|
static int goldfish_pipe_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe *pipe;
|
struct goldfish_pipe *pipe;
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
int32_t status;
|
int32_t status;
|
||||||
|
|
||||||
/* Allocate new pipe kernel object */
|
/* Allocate new pipe kernel object */
|
||||||
|
@ -558,7 +558,7 @@ static const struct file_operations goldfish_pipe_fops = {
|
||||||
.release = goldfish_pipe_release,
|
.release = goldfish_pipe_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct miscdevice goldfish_pipe_dev = {
|
static struct miscdevice goldfish_pipe_miscdev = {
|
||||||
.minor = MISC_DYNAMIC_MINOR,
|
.minor = MISC_DYNAMIC_MINOR,
|
||||||
.name = "goldfish_pipe",
|
.name = "goldfish_pipe",
|
||||||
.fops = &goldfish_pipe_fops,
|
.fops = &goldfish_pipe_fops,
|
||||||
|
@ -566,15 +566,16 @@ static struct miscdevice goldfish_pipe_dev = {
|
||||||
|
|
||||||
int goldfish_pipe_device_init_v1(struct platform_device *pdev)
|
int goldfish_pipe_device_init_v1(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
int err = devm_request_irq(&pdev->dev, dev->irq,
|
int err = devm_request_irq(&pdev->dev, dev->irq,
|
||||||
goldfish_pipe_interrupt, IRQF_SHARED, "goldfish_pipe", dev);
|
goldfish_pipe_interrupt, IRQF_SHARED, "goldfish_pipe", dev);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "unable to allocate IRQ for v1\n");
|
dev_err(&pdev->dev, "unable to allocate IRQ for v1\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = misc_register(&goldfish_pipe_dev);
|
err = misc_register(&goldfish_pipe_miscdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "unable to register v1 device\n");
|
dev_err(&pdev->dev, "unable to register v1 device\n");
|
||||||
return err;
|
return err;
|
||||||
|
@ -586,5 +587,5 @@ int goldfish_pipe_device_init_v1(struct platform_device *pdev)
|
||||||
|
|
||||||
void goldfish_pipe_device_deinit_v1(struct platform_device *pdev)
|
void goldfish_pipe_device_deinit_v1(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
misc_deregister(&goldfish_pipe_dev);
|
misc_deregister(&goldfish_pipe_miscdev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,6 @@ struct goldfish_pipe_dev {
|
||||||
struct access_params *aps;
|
struct access_params *aps;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct goldfish_pipe_dev pipe_dev[1];
|
extern struct goldfish_pipe_dev goldfish_pipe_dev;
|
||||||
|
|
||||||
#endif /* GOLDFISH_PIPE_H */
|
#endif /* GOLDFISH_PIPE_H */
|
||||||
|
|
|
@ -213,7 +213,7 @@ struct goldfish_pipe {
|
||||||
struct goldfish_pipe_dev *dev;
|
struct goldfish_pipe_dev *dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct goldfish_pipe_dev pipe_dev[1] = {};
|
struct goldfish_pipe_dev goldfish_pipe_dev;
|
||||||
|
|
||||||
static int goldfish_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd)
|
static int goldfish_cmd_locked(struct goldfish_pipe *pipe, enum PipeCmdCode cmd)
|
||||||
{
|
{
|
||||||
|
@ -572,11 +572,12 @@ static struct goldfish_pipe *signalled_pipes_pop_front(
|
||||||
|
|
||||||
static void goldfish_interrupt_task(unsigned long unused)
|
static void goldfish_interrupt_task(unsigned long unused)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
|
||||||
/* Iterate over the signalled pipes and wake them one by one */
|
/* Iterate over the signalled pipes and wake them one by one */
|
||||||
struct goldfish_pipe *pipe;
|
struct goldfish_pipe *pipe;
|
||||||
int wakes;
|
int wakes;
|
||||||
while ((pipe = signalled_pipes_pop_front(dev, &wakes)) != NULL) {
|
|
||||||
|
while ((pipe = signalled_pipes_pop_front(&goldfish_pipe_dev, &wakes)) !=
|
||||||
|
NULL) {
|
||||||
if (wakes & PIPE_WAKE_CLOSED) {
|
if (wakes & PIPE_WAKE_CLOSED) {
|
||||||
pipe->flags = 1 << BIT_CLOSED_ON_HOST;
|
pipe->flags = 1 << BIT_CLOSED_ON_HOST;
|
||||||
} else {
|
} else {
|
||||||
|
@ -613,7 +614,8 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void *dev_id)
|
||||||
u32 i;
|
u32 i;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct goldfish_pipe_dev *dev = dev_id;
|
struct goldfish_pipe_dev *dev = dev_id;
|
||||||
if (dev != pipe_dev)
|
|
||||||
|
if (dev != &goldfish_pipe_dev)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
/* Request the signalled pipes from the device */
|
/* Request the signalled pipes from the device */
|
||||||
|
@ -676,7 +678,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev *dev)
|
||||||
*/
|
*/
|
||||||
static int goldfish_pipe_open(struct inode *inode, struct file *file)
|
static int goldfish_pipe_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int id;
|
int id;
|
||||||
int status;
|
int status;
|
||||||
|
@ -773,7 +775,7 @@ static const struct file_operations goldfish_pipe_fops = {
|
||||||
.release = goldfish_pipe_release,
|
.release = goldfish_pipe_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct miscdevice goldfish_pipe_dev = {
|
static struct miscdevice goldfish_pipe_miscdev = {
|
||||||
.minor = MISC_DYNAMIC_MINOR,
|
.minor = MISC_DYNAMIC_MINOR,
|
||||||
.name = "goldfish_pipe",
|
.name = "goldfish_pipe",
|
||||||
.fops = &goldfish_pipe_fops,
|
.fops = &goldfish_pipe_fops,
|
||||||
|
@ -782,7 +784,7 @@ static struct miscdevice goldfish_pipe_dev = {
|
||||||
static int goldfish_pipe_device_init_v2(struct platform_device *pdev)
|
static int goldfish_pipe_device_init_v2(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
char *page;
|
char *page;
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
int err = devm_request_irq(&pdev->dev, dev->irq, goldfish_pipe_interrupt,
|
int err = devm_request_irq(&pdev->dev, dev->irq, goldfish_pipe_interrupt,
|
||||||
IRQF_SHARED, "goldfish_pipe", dev);
|
IRQF_SHARED, "goldfish_pipe", dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -790,7 +792,7 @@ static int goldfish_pipe_device_init_v2(struct platform_device *pdev)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = misc_register(&goldfish_pipe_dev);
|
err = misc_register(&goldfish_pipe_miscdev);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "unable to register v2 device\n");
|
dev_err(&pdev->dev, "unable to register v2 device\n");
|
||||||
return err;
|
return err;
|
||||||
|
@ -839,17 +841,16 @@ static int goldfish_pipe_device_init_v2(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void goldfish_pipe_device_deinit_v2(struct platform_device *pdev) {
|
static void goldfish_pipe_device_deinit_v2(struct platform_device *pdev) {
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
misc_deregister(&goldfish_pipe_miscdev);
|
||||||
misc_deregister(&goldfish_pipe_dev);
|
kfree(goldfish_pipe_dev.pipes);
|
||||||
kfree(dev->pipes);
|
free_page((unsigned long)goldfish_pipe_dev.buffers);
|
||||||
free_page((unsigned long)dev->buffers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int goldfish_pipe_probe(struct platform_device *pdev)
|
static int goldfish_pipe_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
struct resource *r;
|
struct resource *r;
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
|
|
||||||
BUILD_BUG_ON(sizeof(struct goldfish_pipe_command) > PAGE_SIZE);
|
BUILD_BUG_ON(sizeof(struct goldfish_pipe_command) > PAGE_SIZE);
|
||||||
|
|
||||||
|
@ -902,7 +903,7 @@ error:
|
||||||
|
|
||||||
static int goldfish_pipe_remove(struct platform_device *pdev)
|
static int goldfish_pipe_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct goldfish_pipe_dev *dev = pipe_dev;
|
struct goldfish_pipe_dev *dev = &goldfish_pipe_dev;
|
||||||
|
|
||||||
if (dev->version < PIPE_CURRENT_DEVICE_VERSION)
|
if (dev->version < PIPE_CURRENT_DEVICE_VERSION)
|
||||||
goldfish_pipe_device_deinit_v1(pdev);
|
goldfish_pipe_device_deinit_v1(pdev);
|
||||||
|
|
Loading…
Add table
Reference in a new issue