{"comment":{"url":"https://api.github.com/repos/igorpecovnik/lib/comments/17544234","html_url":"https://github.com/igorpecovnik/lib/commit/dff98cae2e3c1c691e8f46f40a036a7866a15806#commitcomment-17544234","id":17544234,"user":{"login":"zador-blood-stained","id":14262690,"avatar_url":"https://avatars.githubusercontent.com/u/14262690?v=3","gravatar_id":"","url":"https://api.github.com/users/zador-blood-stained","html_url":"https://github.com/zador-blood-stained","followers_url":"https://api.github.com/users/zador-blood-stained/followers","following_url":"https://api.github.com/users/zador-blood-stained/following{/other_user}","gists_url":"https://api.github.com/users/zador-blood-stained/gists{/gist_id}","starred_url":"https://api.github.com/users/zador-blood-stained/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zador-blood-stained/subscriptions","organizations_url":"https://api.github.com/users/zador-blood-stained/orgs","repos_url":"https://api.github.com/users/zador-blood-stained/repos","events_url":"https://api.github.com/users/zador-blood-stained/events{/privacy}","received_events_url":"https://api.github.com/users/zador-blood-stained/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":null,"commit_id":"dff98cae2e3c1c691e8f46f40a036a7866a15806","created_at":"2016-05-19T17:15:34Z","updated_at":"2016-05-19T17:15:34Z","body":"Original code (`budget_get_any_online_cpu`), here indentation is wrong already and code can be simplified, but it works.\r\n```\r\nstatic int budget_get_any_online_cpu(const cpumask_t *mask)\r\n{\r\n\tint cpu,lastcpu=0xffff;\r\n\r\n\tfor_each_cpu(cpu, mask) {\r\n\t\tif ((cpu != boot_cpu) && cpu_online(cpu)){\r\n\t\t\tif(lastcpu == 0xffff)\r\n\t\t\t\tlastcpu = cpu;\r\n\t\telse if(cpu >lastcpu)\r\n\t\t\tlastcpu = cpu;\r\n\t\t}\r\n\t}\r\n\treturn lastcpu;\r\n}\r\n```\r\n\r\nBased on this `budget_get_any_offline_cpu` would look like this (I changed `cpu_is_offline` to `!cpu_online`, but didn't push new version of this patch yet):\r\n```\r\nstatic int budget_get_any_offline_cpu(const cpumask_t *mask)\r\n{\r\n\tint cpu,lastcpu=0xffff;\r\n\r\n\tfor_each_cpu(cpu, mask) {\r\n\t\tif (!cpu_online(cpu)){\r\n\t\t\tif(lastcpu == 0xffff)\r\n\t\t\t\tlastcpu = cpu;\r\n\t\t \telse if(cpu >lastcpu)\r\n\t\t\t\tlastcpu = cpu;\r\n\t\t}\r\n\t}\r\n\treturn lastcpu;\r\n}\r\n```\r\n"}}